|Re: calculation of retained size for primitive arrays [message #5166 is a reply to message #5031]
||Wed, 17 September 2008 19:39
| Andreas Buchen
Registered: July 2009
> I've noticed that calculation of retained sizes of (single-dimensional) |
> primitive arrays sometimes takes a few seconds to complete.
Can you give a little more details? The retained size of each and every
object is pre-calculated during the parsing. It is stored in one of the
separate index files. Primitive arrays are not handled differently. The
index is not kept in memory (in fact, it would be too big) but read page
by page. So only loading a page should make a noticeable difference.
> I'd expect it to be instant, the retained size will always equal the
> shallow size. In addition, invoking approx. retained size for a set of
> object could simply give the exact retained size for the subset of
> objects that are primitive arrays.
Now, if you select multiple objects, the retained size needs to be
calculated. Either by doing a "mark-and-sweep" (precise) or by looking up
the object in the dominator tree and summing up unique sub-trees
(approximation). Indeed, if the object only contains primitive arrays,
summing up the individual sizes gives the correct result.
Let me put some more thoughts into this. Currently, the algorithm only
gets a bunch of objects ids (in fact, it is an int array) and hence cannot
easily take that shortcut. But the information is there. Thanks for the
Powered by FUDForum
. Page generated in 0.02008 seconds