Developers are more
concerned about the size of objects when they are created. Eclipse memory
analyzer gives us information about the size of the object in 2 calculations.
Shallow Heap
Retained Heap
Shallow heap is the
memory consumed by one object. An object needs 32 or 64 bits (depending on the
OS architecture) per reference, 4 bytes per Integer, 8 bytes per Long, etc.
Depending on the heap dump format the size may be adjusted (e.g. aligned to 8,
etc...) to model better the real consumption of the VM.
Shallow size of an
object is the amount of allocated memory to store the object itself, not taking
into account the referenced objects
Retained size of an
object is its shallow size plus the shallow sizes of the objects that are
accessible, directly or indirectly, only from this object. In other words, the
retained size represents the amount of memory that will be freed by the garbage
collector when this object is collected
Dead objects are
shown only with shallow size, as they do not actually retain any other objects.
Generally speaking,
shallow size of an object is its "flat" size in the heap whereas the
retained size of the same object is the amount of heap memory that will be
freed when the object is garbage collected.
For example the
shallow size of an instance of java.lang.String will not include the memory
needed for the underlying char[] where as retained size includes.
Excellent site. A lot of useful information here. I'm sending it to some pals ans also sharing
ReplyDeletein delicious. And naturally, thank you for your sweat!
Feel free to surf to my webpage brainfire pills
It's very easy to find out any topic on net as compared to books,
ReplyDeleteas I found this article at this website.
Feel free to surf to my web-site - CogniQ Brain Supplement
Its like you read my mind! You appear to know a lot about this, like you wrote
ReplyDeletethe book in it or something. I think that you can do with some pics to drive the message home a bit, but instead of that, this is fantastic blog.
A fantastic read. I will definitely be back.
Also visit my blog; Brain Peak
It is the best time to make some plans for the future and it's time to be happy.
ReplyDeleteI have read this post and if I could I desire
to suggest you some interesting things or suggestions.
Perhaps you can write next articles referring to this article.
I wish to read more things about it!