Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ObjectGraphMeasurer not giving arrays their due respect #6

Open
GoogleCodeExporter opened this issue Mar 14, 2015 · 1 comment
Open

Comments

@GoogleCodeExporter
Copy link

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 dnathan...@tidemark.com on 29 Jul 2014 at 5:23

@GoogleCodeExporter
Copy link
Author

Never mind.  Not as big a difference as stated in bug. Array memory block is 
accounted for.  Only extra 4 bytes for length of array object is not accounted 
for.

Original comment by dnathan...@tidemark.com on 30 Jul 2014 at 6:23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant