It is being a lot of hour re-searching and try find wth is calling a unsafe.allocateMemory and no success at all. Kind of disappointed :-( Im not a expert or profile or with jemalloc but here is what I did so far and hopefully someone can see/find what I could not...
I see that something is calling the unsafe.allocateMemory and not calling the unsafe.freeMemory after done, so it will eat all my memory. I did a thread dump from the application (link to the txt with the thread dump) but unfortunately I was not able to find anything related to the unsafe.allocateMemory. Can anyone see something that I was not able to see or helping me by giving me any clue or pointing me in the right direction ? Thank you....
Try async-profiler. It can show you complete Java stack traces of all callers of Unsafe_AllocateMemory0
.
Example:
./profiler.sh -e Unsafe_AllocateMemory0 -f alloc.html <pid>
The output file alloc.html
will be a flame graph of all Unsafe_AllocateMemory0
calls:
For more information about finding native memory leaks in Java, see this question and this discussion.