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

Thomas Schatzl thomas.schatzl at oracle.com
Fri Aug 23 08:11:58 UTC 2013


Hi,

On Fri, 2013-08-23 at 09:46 +0800, Lijie Xu wrote:
>[...]
>
> 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 address information generated by
> +PrintGCDetails about each space. For example,

If you have object addresses you can use the information from -XX:
+PrintGCDetails to infer its location.
> 
> Heap
>  def new generation   total 153600K, used 152935K [0x14710000,
> 0x1edb0000, 0x1edb0000)

The young generation has a total size of 153M, where slightly less are
used; the three values next are reservation start address, upper
committed address, and reservation end address.

>   eden space 136576K, 100% used [0x14710000, 0x1cc70000, 0x1cc70000)
>   from space 17024K,  96% used [0x1dd10000, 0x1ed09f60, 0x1edb0000)
>   to   space 17024K,   0% used [0x1cc70000, 0x1cc70000, 0x1dd10000)

Lowest address, upper used and highest address for the eden (nursery)
and from/to survivor spaces.

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

Same as above for the old (tenured) generation.

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

The old generation is a single blob of memory, no further split into
multiple spaces.

>  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)

Same information for the permanent generation as above.

>
> What's the exact meaning of these multiple address?

(You are using serial gc; other collectors have different output btw).

Hth,
Thomas






More information about the hotspot-gc-dev mailing list