-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Description
It seems that ObjectGraphMeasurer does not take into account the memory used by
an array. It handles visiting the elements in the array, but the array itself
is only incrementing the object count by 1. This causes severe underestimation
of memory used since the best we can do with Footprint is to multiply object
count by 16 (overhead in bytes for an object) plus a little randomness for
padding.
Java collections use a lot of arrays internally, so even if you don't use
arrays directly in your code, there can still be lots of arrays in use
indirectly. These arrays can take up a lot a memory based on length * size of
objects in array (anywhere from 1, 2, 4 or 8).
Perhaps Footprint could return arrays the same way it returns primitives which
would allow caller to more accurately estimate size by doing the multiplication
after graph is visited.
Original issue reported on code.google.com by [email protected] on 29 Jul 2014 at 5:23