leakcanary: Leak analysis failed: OutOfMemoryError

LeakCanary Version: 1.4-beta2


* FAILURE:
java.lang.OutOfMemoryError: Failed to allocate a 2807208 byte allocation with 2467638 free bytes and 2MB until OOM
    at com.squareup.haha.trove.TLongHashSet.rehash(TLongHashSet.java:162)
    at com.squareup.haha.trove.THash.postInsertHook(THash.java:283)
    at com.squareup.haha.trove.TLongHashSet.add(TLongHashSet.java:146)
    at com.squareup.haha.perflib.analysis.TopologicalSort$TopologicalSortVisitor.doVisit(TopologicalSort.java:91)
    at com.squareup.haha.perflib.analysis.TopologicalSort.compute(TopologicalSort.java:36)
    at com.squareup.haha.perflib.Snapshot.computeDominators(Snapshot.java:311)
    at com.squareup.leakcanary.HeapAnalyzer.findLeakTrace(HeapAnalyzer.java:157)
    at com.squareup.leakcanary.HeapAnalyzer.checkForLeak(HeapAnalyzer.java:91)
    at com.squareup.leakcanary.internal.HeapAnalyzerService.onHandleIntent(HeapAnalyzerService.java:58)
    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 3
  • Comments: 30 (5 by maintainers)

Most upvoted comments

Re-opening this issue for tracking purposes. There are multiple ways to tackle the problem, but until then this is useful. Not everyone may check the issues before posting, but I’d wager even fewer search for closed issues before posting.

LeakCanary 2.0 will have a new heap dump parser with a much lower memory footprint. This should make all those OutOfMemoryError crashes go away.

Hi,

It seems always in 1.5.1:

 * FAILURE in 1.5.1 1be44b3:java.lang.OutOfMemoryError: OutOfMemoryError thrown while trying to throw OutOfMemoryError; no stack available
  
  * Reference Key: 896e8324-3968-46e7-9ad9-b8dd168b4e8b
  * Device: asus asus P01W WW_P01W
  * Android Version: 5.0.2 API: 21 LeakCanary: 1.5.1 1be44b3
  * Durations: watch=71698ms, gc=351ms, heap dump=4797ms, analysis=60220ms
  * Excluded Refs:
  | Field: android.app.ActivityThread$ActivityClientRecord.nextIdle
  | Field: android.view.inputmethod.InputMethodManager.mNextServedView
  | Field: android.view.inputmethod.InputMethodManager.mServedView
  | Field: android.view.inputmethod.InputMethodManager.mServedInputConnection
  | Field: android.view.inputmethod.InputMethodManager.mCurRootView
  | Field: android.animation.LayoutTransition$1.val$parent
  | Field: android.view.textservice.SpellCheckerSession$1.this$0
  | Field: android.support.v7.internal.widget.ActivityChooserModel.mActivityChoserModelPolicy
  | Field: android.widget.ActivityChooserModel.mActivityChoserModelPolicy
  | Field: android.accounts.AccountManager$AmsTask$Response.this$1
  | Field: android.media.MediaScannerConnection.mContext
  | Field: android.os.UserManager.mContext
  | Field: android.appwidget.AppWidgetHost$Callbacks.this$0
  | Field: android.media.AudioManager$1.this$0
  | Field: android.widget.Editor$Blink.this$0
  | Field: android.net.ConnectivityManager.sInstance
  | Field: android.view.Choreographer$FrameDisplayEventReceiver.mMessageQueue (always)
  | Static field: android.media.session.MediaSessionLegacyHelper.sInstance
  | Static field: android.text.TextLine.sCached
  | Thread:FinalizerWatchdogDaemon (always)
  | Thread:main (always)
  | Thread:LeakCanary-Heap-Dump (always)
  | Class:java.lang.ref.WeakReference (always)
  | Class:java.lang.ref.SoftReference (always)
  | Class:java.lang.ref.PhantomReference (always)
  | Class:java.lang.ref.Finalizer (always)
  | Class:java.lang.ref.FinalizerReference (always)

A workaround or tips ?

Thanks