开发者

monitor Java process memory in realtime

开发者 https://www.devze.com 2023-02-10 00:41 出处:网络
I have a java application that its memory starting to jump and fall after few days. Is the开发者_StackOverflow社区re a tool that can show me the variables/members sizes during run/debug in real time?

I have a java application that its memory starting to jump and fall after few days.

Is the开发者_StackOverflow社区re a tool that can show me the variables/members sizes during run/debug in real time?

Debugging it with eclipce is impossible.


Check out jhat and jmap.

In the longer run, consider adding a monitor to your app (with JMX, or write your own). It may help you in many situations in future.


Install this: http://visualvm.java.net/eclipse-launcher.html and then launch using Eclipse. This does not use the debugger, but launches the VisualVM application which lets you monitor the app. You'll need to go into the Run Configurations.. settings to set this up, and select VisualVM launcher at the bottom (Select Other... -> VisualVM launcher). You'll need to go into Preferences to set up the location of VisualVM too.

(On later Eclipse versions, drop it into the drops folder, unpacked).


If you're using >JDK6 and can get access to the machine then jvisualvm.exe may work, part of the JDK (in the bin dir)


yourkit (http://www.yourkit.com/) can do that, but expect a HUGE degradation on the performance of the app, as it has to track the size of each object.

I think it's better if you run yourkit with a few less invasive options, and then you can take snapshots of the memory usage.

I forgot to add, that with yourkit you can run the application without almost any instrumentation (which will slightly degrade the performance of the app) and when the problems start ocurring, you can enable the more heavy weight profiling while the app is running.

0

精彩评论

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