在运行时查看Java堆内容 [英] See the java heap content in run time

查看:113
本文介绍了在运行时查看Java堆内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找能让我看到在运行时如何在堆上创建对象的任何工具. 我使用的是VisualVM-Profiles,但无法找到何时创建特定类型的变量(我正在寻找的变量).也许我做错了... 我也将很高兴收到任何提示,提示如何使用任何API获取此类信息.

I am looking for any tool that allows me to see how objects are created on heap in run time. I was using VisualVM - Profiles but was not able to find when a variable of specific type (the one I am looking for) is being created. Maybe I do something wrong... I will be also thankful getting any hint how to get such information using any API.

关于, 马辛

推荐答案

通常,探查器(例如分配记录已解释截屏.

Typically, profilers (such as JProfiler) will allow you to see this - see for example the Allocation recording explained screencast.

但是,他们通过将代理程序附加到JVM来实现这一目标,该代理程序允许他们拦截低级操作-用户或Java程序通常都无法使用此信息.这样,您将无法通过JConsole或JVisualVM之类的JMX应用程序查看堆.

However, they achieve this by attaching an agent to the JVM that allows them to intercept the low-level operations - this information is not usually available to either users or Java programs. As such, you won't be able to see the heap via JMX apps such as JConsole or JVisualVM.

这篇关于在运行时查看Java堆内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆