leakcanary
leakcanary copied to clipboard
Have shark-cli list classes that have gaps
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.
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