开发者

See the java heap content in run time

开发者 https://www.devze.com 2023-02-09 00:54 出处:网络
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 lo

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开发者_StackOverflow中文版 any hint how to get such information using any API.

Regards, Marcin


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

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.


Inside VisualVM Profiler, select the Settings and specify the class you want to profile. May be you also need to look on the option which record allocation stacks.


It sounds like you are trying to debug a program and that using the debugger would be the best option. You should be able to add a conditional breakpoint to stop the program when a variable is assigned the value you are looking for. This will allow you to see all the values at that time and the call stack to see what was called to create it.

0

精彩评论

暂无评论...
验证码 换一张
取 消