Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JVMTI Heap Measurement vs. external measurement

843829May 4 2006 — edited Jun 2 2006
Hello,


I am about to do some memory distribution analysis of the content of a java heap. In a first step I build an JVMTI agent which writes all reachable objects with their size to a file. For each reference caught by
IterateOverReachableObjects()
I write refererer and referee to another file too.

First the sum of all object sizes is is around 130 % of the heap size reported by
jstat
and
Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()
Both report exactly the same.

Taking the sum of all objects only found as referees is the references-file is little smaller, but none the less significantly larger than reported by the two named possibilities.

Whats the reason for this? What is wrong on my approach? Is it what the JVMTI reference says? That :

"... This size is an implementation-specific approximation of the amount of storage consumed by this object. It may include some or all of the object's overhead, and thus is useful for comparison within an implementation but not between implementations. The estimate may change during a single invocation of the JVM."


Robert
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 30 2006
Added on May 4 2006
14 comments
395 views