VisualVM 中活动对象和分配对象有什么区别?
如此处的屏幕截图所示,0 个活动对象,9 个已分配对象。
活动对象和分配对象有什么区别?
As seen in the screenshot here, 0 live objects, 9 allocated objects.
What's the difference between a live and an allocated object?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
已分配对象的数量并不是垃圾收集器尚未回收的对象数量。相反,它是自应用程序启动以来或自 VisualVM 中重置“收集结果缓冲区”以来创建的对象数(内存分析器视图中有一个按钮可重置收集结果缓冲区)。
存活对象是那些还没有被垃圾收集器回收的对象;这可能包括无法访问的对象,并且肯定包括应用程序仍在使用的对象。
The number of allocated objects is not the number of objects not yet reclaimed by the garbage collector. Rather, it is the number of objects created since application start, or since a reset of the "Collected Results Buffer" in VisualVM (there is a button in the memory profiler view to reset the collected results buffer).
The live objects are those objects that haven't been reclaimed by the garbage collector; this may include objects that are unreachable, and will definitely include objects that are still in use by the application.