My multithrea开发者_开发问答ded Java program crashes because it runs out of heap space and I don't think it should. Assuming the culprit is unintentional object retention, what's a good free tool to investigate what objects are being unintentionally retained?
My IDE is Eclipse.
Here's a list of open source tools you can look at: http://java-source.net/open-source/profilers . Of course, JMap and JConsole are also possible solutions.
A tool like Eclipse MAT will help to find greedy memory pigs and has even a memory leak detector.
The memory profiler of Visual VM might also help if you need to go at a lower level.
The last time I looked into free profilers, they weren't nearly as good as the established commercial ones.
I recommend evaluating
- JProfiler
- YourKit
- JProbe
A good profiler, compared to a bad one, can easily save you a day of debugging work immediately and that pays for the license (and for the people doing the great job developing these nice tools).
All three plug into Eclipse and allow you to start profiling directly from Eclipse, from your current project, so there is no tedious work to set up the CLASSPATH.
Sun's VisualVM is free, but I am a big fan of JProfiler which is a commercial app, although you can get a 30 day trial.
I would start with tools that come with JDK, jconsole and jmap. There is good article about JVM monitoring on java.sun.com.
精彩评论