research task: shallow or deep?
Need to discover whether the jmap -histo data byte counts are shallow, deep, or somewhere between.
Need to use data from examples in issue #4.
This stackoverflow question suggests a number of things remain unanswered.
bytes in jmap -histo are shallow, not deep. For example, this stackoverflow question prints:
num #instances #bytes class name
----------------------------------------------
1: 1134597 5834904800 [B
2: 407694 144032664 [Ljava.lang.Object;
3: 2018132 111547480 [C
...
7: 975220 23405280 java.lang.String
...
So the bytes size of String instances are 23405280 / 975220 = 24 bytes exactly per instance (in this JVM). It is impossible that String instances are only 24 bytes including contents. So the bytes size in jmap -histo is shallow.
The bytes size depends in fact of the types and numbers of attributes declared in the class and of 32-bits/64-bits/compressed oop. The bytes size can be computed for an object according to the Java Language Specification: see for example, https://stackoverflow.com/questions/52353/in-java-what-is-the-best-way-to-determine-the-size-of-an-object