calculation of retained size for primitive arrayshttps://www.eclipse.org/forums/index.php/mv/msg/1762/5031/#msg_5031
I've noticed that calculation of retained sizes of (single-dimensional)
primitive arrays sometimes takes a few seconds to complete.

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.

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!