How to find which heap an object is in ?

Questions about YourKit Java Profiler
Post Reply
suaroman
Posts: 1
Joined: Wed Mar 25, 2015 11:10 am

How to find which heap an object is in ?

Post by suaroman »

Hi Everyone,

I collected a memory snapshot of a particular jvm via the yjp agent.
When I review the dump (post mortem) via yourkit, I see Memory usage telemetry under the Memory tab. There I can see the various heaps such as PS Eden , PS Survivor , PS Old Gen, etc... If I hover over the Heap Memory graph, there's a breakdown of objects (in MB) that reside in each space. (e.g. Eden ,204 MB, PS Old Gen, 31MB, etc...).

How can I determine which objects are contained in what space ? For example, there is 31MB of allocated objects in Old Gen. How can I see what these objects are ?
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: How to find which heap an object is in ?

Post by Anton Katilin »

Hi,

JVM does not provide means to explicitly identify the heap generation for a particular object. It gives only the generation sizes.

The heap generation is related with object age: older objects are promoted from Eden to the Old Gen during GC. This allows to use the following profiler features to estimate the object age instead:

- Generations (in the profiler's sense)
https://www.yourkit.com/docs/java/help/generations.jsp

- Object ages (requires allocation recording)
https://www.yourkit.com/docs/java/help/ages.jsp

Also, objects bigger than some particular size threshold are directly created in the Old Gen. So you may consider that all objects with big shallow size (normally, big arrays) are in the Old Gen. The following stackoverflow thread may be helpful: http://stackoverflow.com/questions/2461 ... generation

Best regards,
Anton
Post Reply