我的 Java 内存去哪儿了?
我正在从 Ant 或 Eclipse 运行 JUnit 测试套件。 PermGen 限制为 200 MB,堆限制为 1000 MB。
Java VisualVM 报告分配 PermGen 为 200 MB,分配堆为 350 MB。那是 550 MB。
但是,该进程的总虚拟集大小为 2.5 GB,驻留集大小为 1.8 GB。我知道应该有一些开销,但如果 PermGen 和堆是 0.5 GB 并且进程使用 1.8 GB,那么缺少的 1.3 GB 在哪里?我该如何诊断和修复它?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
什么是堆空闲率?您使用默认的 70 和 40% 吗?也许,有垃圾对象等待下一次 gc 运行时收集。也可能 java 进程已经为自己分配了额外的内存(了解堆空闲比率)。
也许调整 Java 中的垃圾收集参数中提到的问题/答案/评论提供了一些帮助。
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.
请检查这个eclipse插件进行内存分析。安装后,它会提供不同的视图。在一个特定视图中,它显示了各个对象使用的内存。这将帮助您查明正在使用内存的对象。
编辑:我想我错过了非堆部分。
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.