Is there a way to see what specific objects are in which specific generation (eden, old, etc) in JVM? I am trying to figure out a way to see where exactly which objects are being problematic. I am using JProfiler, recording memory will tell you the live and GCed objects at any point of time, but doesn't tell you which generations the objects are in. Any other tool that tells this? I can't seem to find any such GC debug option also.
On a side note, recording memory with JProfiler seems to be having too much overhead on the application so either I am unable to record memory for a long time (reaches peak memory quickly) or the overhead somehow interferes with/affects the application behavior. Also, recording memory. Any suggestions on this (Am I missing switch to avoid this)? I generally Dynamic Instrumentation option, but as far as I can remember the couple of times I used Sampling also had the same effect.
yourkit is able to do what you want. To be more precise, you can see minor and major garbage collections.
Edit: Some people in SO agreed with me. Which Java profiler is better: JProfiler or YourKit?
enable the jvm flag for printing GC: -XX:-PrintGCDetails Print more details at garbage collection. Manageable. (Introduced in 1.4.0.)
another thing that you can do is using JVisualVM (build it in the jdk1.6) with the visual GC plugin: http://visualvm.java.net/plugins.html