协调 jconsole 和 top 的输出
我正在尝试研究 Java 中的内存管理。我有一个程序可以创建一个大集合(~500MB)。我运行 java 时没有任何特殊参数。一旦该收集超出范围,我就会使用 System.gc() 调用垃圾收集器。从 jconsole 中,我可以看到使用的堆内存显着减少。对于 top
linux 命令的 RES 输出来说,情况并非如此。
我唯一的解释是,一旦 JVM 获得了内存,只要它正在运行,它就不会将其释放给系统。这是正确的吗?
I am trying to look at memory management in Java. I have a program that creates a large collection (~500MB). I run java
without any special arguments. Once this collection goes out of scope, I invoke the garbage collector using System.gc()
. From jconsole, I can see that the heap memory in use is dramatically reduced. The same cannot be said of the RES output of the top
linux command.
My only interpretation is that once the JVM gets hold of memory, it does not release it to the system as long as it is running. Is this correct?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论