There is no easy way to do this, however, I recently analyzed the memory performance of large java applications and can share my experience.
Here's how I found which objects are pushing into the old gene:
First you need to determine which objects are in the "old / occupied" space. This is basically standard java heap analysis. For this, I recommend jmap. This is part of the solar jvm. run: jmap -dump:file=heap.hprof PID to get a bunch of heaps. This will cause jvm to pause during reset (~ for 30 seconds on a 2GB heap)
Upload the .prof file to the Memory Analyzer (the best tool for this, hands down) I would spend the whole day playing with the memory analyzer, to understand this, look at screencam (login required, but worth it).
Now you will find out what objects are in your heap.
Here's the trick: on the overview screen of the memory analyzer, there is a link to: "Histogram of inaccessible objects." Now these objects should be collected during the next GC. But some of them are probably in Eden, some in the survivor and some in the old age.
Now, get some profiler with memory profiling option, I prefer your Kit. Launch the application using yourkit and specify the location of the object.
Run it and record the creation of the object. When you have a list of created objects, use all three lists to get an idea of what is going on. Do what people do best, see pictures.
- What objects are created and available. (Memory analyzer)
- Inaccessible objects on the heap (memory analyzer)
- Objects Created During Run (Profiler)
Another way to get closer is to watch your generation. You can take pictures of your heap and compare which objects are still alive between snapshots. If you use this with visualgc , you can determine how long an object needs to be alive in order to be promoted to the old gene, and take pictures at these intervals to see which objects are still alive.
OK, good luck. / DT
Jt.
source share