How to identify individual object's location in JVM heap space

云达(Yunda) yunda.mly at taobao.com
Fri Aug 23 08:34:48 UTC 2013


Xu,

 

Actually the heap dump records the address of each object(The structure of heap dump is described in share/vm/services/heapDumper.cpp and object ID of an object is its address). So you can write a program to analyze the heap dump on your own to get the heap location of each object. 

 

As for the address information generated by +PrintGCDetails, the three addresses of a generation are low boundary address, high address and high boundary address. High address is the current end address and high boundary address is the maximum address the generation can expand to, so the “total” of a generation is high address minus low boundary address. While the three addresses of a space are bottom address, top address and end address, and the size of a space is end address minus bottom address and the used size is top address minus bottom address. If there are four addresses of a space, the third one is used by the OffsetTable which I think you can just ignore.

 

 

Yunda

 

From: hotspot-gc-dev-bounces at openjdk.java.net [mailto:hotspot-gc-dev-bounces at openjdk.java.net] On Behalf Of Lijie Xu
Sent: Friday, August 23, 2013 9:46 AM
To: hotspot-gc-dev at openjdk.java.net
Subject: How to identify individual object's location in JVM heap space

 

Hi, all. With the help of jmap or other tools, we can dump heap objects at a specific time. Then we can find out both the number and size of the individual object.

 

At this point, I would like to know the heap location (Eden, S0/S1, or Old) of each object. But I cannot find any related information in the heap dump. How to identify? I really need this information in my project.

 

I think there is a way to know the address of each object and address boundary of each space, since GC algorithms have methods to scan objects in a specific space.

 

I also noticed that there are some A about each space. For example,

 

Heap

 def new generation   total 153600K, used 152935K [0x14710000, 0x1edb0000, 0x1edb0000)

  eden space 136576K, 100% used [0x14710000, 0x1cc70000, 0x1cc70000)

  from space 17024K,  96% used [0x1dd10000, 0x1ed09f60, 0x1edb0000)

  to   space 17024K,   0% used [0x1cc70000, 0x1cc70000, 0x1dd10000)

 tenured generation   total 341376K, used 341220K [0x1edb0000, 0x33b10000, 0x33b10000)

   the space 341376K,  99% used [0x1edb0000, 0x33ae9160, 0x33ae9200, 0x33b10000)

 compacting perm gen  total 12288K, used 188K [0x33b10000, 0x34710000, 0x37b10000)

   the space 12288K,   1% used [0x33b10000, 0x33b3f2c0, 0x33b3f400, 0x34710000)

    ro space 10240K,  42% used [0x37b10000, 0x37f50348, 0x37f50400, 0x38510000)

    rw space 12288K,  54% used [0x38510000, 0x38b906f0, 0x38b90800, 0x39110000)

 

What's the exact meaning of these multiple address?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/hotspot-gc-dev/attachments/20130823/1aacdaf8/attachment.htm>


More information about the hotspot-gc-dev mailing list