leakcanary: Heap analysis failed: OutOfMemoryError

Description

====================================
    STACKTRACE
    
    java.lang.OutOfMemoryError: Failed to allocate a 62822108 byte allocation with 16777216 free bytes and 27MB until OOM
        at okio.Buffer.readByteArray(Buffer.kt:1443)
        at okio.RealBufferedSource.readByteArray(RealBufferedSource.kt:242)
        at shark.HprofReader.readByteArray(HprofReader.kt:861)
        at shark.HprofReader.readPrimitiveArrayDumpRecord(HprofReader.kt:699)
        at shark.HprofHeapGraph$readPrimitiveArrayDumpRecord$1.invoke(HprofHeapGraph.kt:158)
        at shark.HprofHeapGraph$readPrimitiveArrayDumpRecord$1.invoke(HprofHeapGraph.kt:38)
        at shark.HprofHeapGraph.readObjectRecord(HprofHeapGraph.kt:191)
        at shark.HprofHeapGraph.readPrimitiveArrayDumpRecord$shark_graph(HprofHeapGraph.kt:157)
        at shark.HeapObject$HeapPrimitiveArray.readRecord(HeapObject.kt:575)
        at shark.HeapObject$HeapPrimitiveArray.readByteSize(HeapObject.kt:539)
        at shark.HeapAnalyzer$computeRetainedSizes$4.invoke(HeapAnalyzer.kt:314)
        at shark.HeapAnalyzer$computeRetainedSizes$4.invoke(HeapAnalyzer.kt:55)
        at shark.internal.hppc.LongLongScatterMap.forEach(LongLongScatterMap.kt:189)
        at shark.HeapAnalyzer.computeRetainedSizes(HeapAnalyzer.kt:306)
        at shark.HeapAnalyzer.buildLeakTraces(HeapAnalyzer.kt:350)
        at shark.HeapAnalyzer.findLeaks(HeapAnalyzer.kt:163)
        at shark.HeapAnalyzer.analyzeGraph(HeapAnalyzer.kt:144)
        at shark.HeapAnalyzer.analyze(HeapAnalyzer.kt:96)
        at leakcanary.internal.HeapAnalyzerService.analyzeHeap(HeapAnalyzerService.kt:77)
        at leakcanary.internal.HeapAnalyzerService.onHandleIntentInForeground(HeapAnalyzerService.kt:58)
        at leakcanary.internal.ForegroundService.onHandleIntent(ForegroundService.kt:55)
        at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:67)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.os.HandlerThread.run(HandlerThread.java:61)
    ====================================

Version Information

    Build.VERSION.SDK_INT: 24
    Build.MANUFACTURER: motorola
    LeakCanary version: 2.2
    Analysis duration: 16243 ms
    Gradle Version: 5.6.4
    Android OS version: 7.0

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (13 by maintainers)

Most upvoted comments

@pyricau Good job! I’ll remove my hprof file from the web by the end of the week: please make a copy of it if needed.

Thanks!

I need to find time to look into that. Here’s what I’d do, if someone is interested:

  • Open the heap dump with profiler on to check the memory footprint and confirm it’s out of the ordinary. The logs indicate only 11Mb left, so figure out what exactly took all the space.
  • Open the heap dump with Android Studio as well as YourKit, to see how these behave.