Where is my Java memory going?

寵の児 提交于 2019-12-23 03:20:14

问题


I am running a JUnit test suite from Ant or Eclipse. PermGen is limited to 200 MB, heap to 1000 MB.

Java VisualVM reports allocated PermGen as 200 MB and allocated heap as 350 MB. That's 550 MB.

However, total virtual set size of this process is 2.5 GB, and resident set size is 1.8 GB. I understand there is supposed to be some overhead, but if PermGen and heap are 0.5 GB and the process is using 1.8 GB, where is the missing 1.3 GB? How can I diagnose and fix it?


回答1:


What is the heap free ratio? Are you using the default 70 and 40%. Maybe, there are garbage objects waiting to be collected by the next gc run. Also maybe the java process has allocated itself the extra memory (read about the heap free ratio).

Maybe the question/ answer/ comments mentioned at Tuning Garbage Collection parameters in Java offer some help.




回答2:


Please check this eclipse plugin for memory analysis . Once you have installed this, it offers different views. In one particular view, its shows the memory used by individual objects. This will help you to pinpoint the objects which are using the memory.

EDIT: I guess I missed the non-heap part.



来源:https://stackoverflow.com/questions/7386294/where-is-my-java-memory-going

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!