leakcanary
leakcanary copied to clipboard
250+ MB Memory Usage by Shark package
Description
My app has leakcanary enabled and it crashed due to memory pressure. I pulled a heap dump and noticed that shark had a total of 250MB+ in retained size.
Is shark expected to hold this much amount of memory ?
Version Information
- LeakCanary version: 2.9.1
- Android OS version: Pixel 6; Android 13
- Gradle version: 7.1.1
Are you sure this is a sum, rather than being sub parts? Android Studio memory analyze tends to not be great at this.
If you could download that heap dump and share it here, I can take a look.
Also would be helpful to have the heapdump that was being analyzed.
250Mb is definitely a lot, Shark is designed to work with very little memory.. in principle!
Sure @pyricau. I shared the heap dump with you. Let me know if you didn't receive it.
Thanks!
- The heap dump file is 187Mb
- Profiler shows memory jumping by 150Mb as part of the analysis.
- Heap dump shows retained size of 108Mb with 89% (85Mb) strongly reachable.
- 65Mb for the in memory index, 17Mb for the dominator tree
- 20Mb of instance index
- the hprof string cache is 18Mb, has 200K entries for a 500K size. Keys is 4Mb
- 16Mb worth of class data
So that large but I guess not totally unexpected?
I couldn't repro "250Mb retained", so I'd love a heap dump of that moment in time. You can export that from Android Studio by clicking on the floppy drive icon.
Actually I think I'm mistaken you already sent me that, rather than the heap dump that was being analyzed itself?