|
Re: calculation of retained size for primitive arrays [message #5166 is a reply to message #5031] |
Wed, 17 September 2008 19:39 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Andreas Buchen![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=andreas.buchen%40gmail.com) Messages: 123 Registered: July 2009 |
Senior Member |
|
|
> 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
idea!
Andreas.
|
|
|
Powered by
FUDForum. Page generated in 0.03785 seconds