问题
I have a program which is not running out of heap but for which the use of anonymous/native memory grows and grows. How can I go about figuring out what is using this memory?
回答1:
Inspect a heap dump for DirectByteBuffer
objects and what's holding onto them. File mappings would also be a cause, but you say anonymous mappings so that's probably not the issue here since those would be named.
For some things native memory tracking may be useful too.
If it's neither DirectByteBuffer instances nor other memory pools managed by the VM it might be some native library used by your application.
来源:https://stackoverflow.com/questions/33573214/how-can-i-figure-out-what-anonymous-memory-is-being-used-for