The system I work with is creating a whole lot of objects and garbage collecting them all the time which results in a very steeply jagged graph of heap consumption. I would like to know which objects are being generated to tune the code, but I can’t figure out a way to dump the heap at the moment the garbage collection starts. When I tried to initiate dumpHeap via JConsole manually at random times, I always got results after GC finished its run, and didn’t get any useful data.
Any notes on how to track down excessive temporary object creation are welcome.
Have a look at what BTrace can do (http://kenai.com/projects/btrace/pages/Home), alternatively try using
jvisualvmin JDK 6u18 which does live memory sampling.