leakcanary icon indicating copy to clipboard operation
leakcanary copied to clipboard

Have shark-cli list classes that have gaps

Open pyricau opened this issue 5 years ago • 1 comments

This is related to this blog: https://dev.to/pyricau/the-real-size-of-android-objects-1i2e

The idea is to compare the heap dump object size to an object size we'd compute. They should be equal if we understand how ART works. If equal, then we can then list the classes that have gaps for alignment and output the ones with the biggest gaps, or provide the memory layout of any class.

pyricau avatar Sep 23 '20 00:09 pyricau

One interesting thing we could do as well since we have a heap dump is multiple those "gaps per class" by the number of instances, and then sort. That'd give us the most wasteful classes that'd really benefit from a change

pyricau avatar Sep 23 '20 18:09 pyricau