I have a class and I'd like to see which sub-objects occupy the most space when object from this class is serialized. Is there any nice tool/way to do it, except from looking at the code and analyzing it manually?
For example I would like the tool to say "member a occupies 20%, b 30% and member c occupies 50%".
Thanks
P.S. I found some related questions, but didn't find answer to my specific question there.
The only relatively fast way to count the size of the object is to first write the whole object, count the usage (for example, write to a ByteArrayOutputStream) and then write each object that is referred to.
There are a couple of this to take into account:
For the description of the protocol, read this description.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With