how to find out the types of the surviving objects after a GC

John Cuthbertson john.cuthbertson at oracle.com
Fri Nov 5 15:25:08 PDT 2010


Hi Tony,

The second word in each oop is the klassOop (a pointer to the structure 
describing the class/type). From that you can get the class name etc. 
For arrays the third word is the array length.

Regards,

JohnC

On 11/05/10 12:11, Tony Guan wrote:
> Dear all,
>
> We are now interested in the types of the surviving objects after a
> GC.  Currently, I plan to do like this:
>
> 1. record the top() address of the old generation before a minor GC.
> 2. iterate oops in the increased portion(between the old top and the
> new top) of the old generation
> 3. for each oop, find out what's the type of the object it stands for.
>
> As I am studying the existing code from hotspot, I also realize that
> this maybe a simple question for you:
> Is there an easy way tell the types from the oop? Or will there be a
> problem in my current plan?
>
> Thanks as always!
>
> Tony (Xiaohua Guan)
>   



More information about the hotspot-runtime-dev mailing list