Open youuupeng opened 5 years ago
🙏Thank you for opening an issue! LeakCanary is maintained by @pyricau with help from the community. Please be kind and remember that LeakCanary isn't anyone's main job 😘.
Thank you for the detailed report!
It looks like it cannot find android.os.Build
in the heap dump, which is very odd, as this class should always be present. Is this heap dump coming from an Android app? Can you please tell what device / Android OS version are you running?
@Armaxis
Yes,it's from an Android app. device:MI PLAY android os version:8.1.0 MIUI version:10.3.4
As you say,it seems like NPE happens in here :
val buildClass = graph.findClassByName("android.os.Build")!!
Strange things is,only two hprof files have NPE,while the other files can be analyzed normally. NPE hprof file:2019-10-21_16-46-57_979.hprof,2019-10-21_16-51-51_598.hprof
Obviously,this two files is smaller than other files,i guess it lacks android.os.Build,but how that happens?
One thing that is definitely suspicious here is the size of the hprof files that crashes - only 220KB and 312KB. This is very small for an Android app heap dump - it means that the whole memory footprint of the app was only 220kb, which is pretty much impossible. Seeing that you also have other memory dumps that are 20-30MB in size, I would make a guess that the crashing hprof is simply incomplete and is not a valid heap dump. How did you obtain it? Did it come from the LeakCanary or from Android Profiler? Cause, if it's coming from LeakCanary then we need to investigate if it is sometimes dumps incomplete heap dump.
It's from LeakCanary.I pull it from my phone.Folder directory is"InternalStorage/Download/leakcanary- < packagename > "
Thanks! We will take a look if there's something wrong with the heap dumper
Fascinating! @Armaxis maybe next steps here might be opening the hprof with both Android Studio profiler and also YourKit, see if it works for those. Could also look at the file content in terms of bytes, see if it's a valid hprof (looks like it is though)
Good idea, I'll give it a look and post back once I find anything.
Both Android Studio and YourKit refused to open the file claiming that it's not a heap dump.
So I went ahead and opened it with Sublime with UTF-8 encoding. Beginning of file shows that it is indeed a heap dump
But the file ends pretty abruptly.
Looks like it just failed to flush the heap dump into the file.
Thanks! What's also interesting is that shark doesnt fail the initial parsing. I wonder if there's content that valid hprofs have that we could look for, so that we can report this invalid without proceeding further.
Next steps: check which blocks are missing from that heap dump and use those to detect "bad" heap dumps and fail early.
Description
Threre is a NPE when using shark to analyze hprof
Steps to Reproduce
2019-10-21_16-51-51_598.zip
Version Information
Additional Information