TourGuide icon indicating copy to clipboard operation
TourGuide copied to clipboard

OutOfMemoryError

Open VictorJava opened this issue 9 years ago • 6 comments

java.lang.OutOfMemoryError: Failed to allocate a 8294412 byte allocation with 16777216 free bytes and 130MB until OOM at dalvik.system.VMRuntime.newNonMovableArray(Native Method) at android.graphics.Bitmap.nativeCreate(Native Method) at android.graphics.Bitmap.createBitmap(Bitmap.java:939) at android.graphics.Bitmap.createBitmap(Bitmap.java:912) at android.graphics.Bitmap.createBitmap(Bitmap.java:879) at tourguide.tourguide.FrameLayoutWithHole.init(FrameLayoutWithHole.java:122) at tourguide.tourguide.FrameLayoutWithHole.(FrameLayoutWithHole.java:87) at tourguide.tourguide.TourGuide$1.onGlobalLayout(TourGuide.java:173) at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:889) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2070) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1191) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6642) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777) at android.view.Choreographer.doCallbacks(Choreographer.java:590) at android.view.Choreographer.doFrame(Choreographer.java:560) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:5942) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)

Of course I use android:largeHeap="true" but It doesn`t help. Samsung s4.

VictorJava avatar Aug 26 '15 07:08 VictorJava

Hi there,

This is not normal at all! We've fixed a memory leak issue previously, and I've installed LeakCanary, it's not currently showing any leak. So I'm not sure where to troubleshoot.

Can you tell me how are you using it so that I can reproduce the same issue?

Thanks!

worker8 avatar Aug 26 '15 07:08 worker8

Thanks for your reply. Yes, I am able to reproduce this issue and I saw the same report with memory overflow like(https://github.com/worker8/TourGuide/issues/4) Our app dynamically update the text in the title of tabs. After code with tourguide show I update my view - after out of memory.

I guess the problem is in TourGuide.class -> setupView() -> ViewTreeObserver.

There is my test app with googles SlidingTabs. screenshot_tourguide

it is doesn`t matter how much chars update.

VictorJava avatar Aug 27 '15 07:08 VictorJava

I'm seeing the same thing, and it has to do with TourGuide.mHighlightedView's global layout listener getting called over and over, even though this listener is removed immediately. Somehow it's not getting removed.

jkreiser avatar Sep 26 '15 23:09 jkreiser

Facing the similar issue in my code which is in production. Device model is SM-G900I running Android 5.0. Was anyone able to figure out a fix for this?

App trace:

java.lang.OutOfMemoryError: Failed to allocate a 8294412 byte allocation with 4807864 free bytes and 4MB until OOM at dalvik.system.VMRuntime.newNonMovableArray(Native Method) at android.graphics.Bitmap.nativeCreate(Native Method) at android.graphics.Bitmap.createBitmap(Bitmap.java:939) at android.graphics.Bitmap.createBitmap(Bitmap.java:912) at android.graphics.Bitmap.createBitmap(Bitmap.java:879) at tourguide.tourguide.FrameLayoutWithHole.init(FrameLayoutWithHole.java:122) at tourguide.tourguide.FrameLayoutWithHole.(FrameLayoutWithHole.java:87) at tourguide.tourguide.TourGuide$1.onGlobalLayout(TourGuide.java:236) at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:863) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2059) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1180) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6558) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777) at android.view.Choreographer.doCallbacks(Choreographer.java:590) at android.view.Choreographer.doFrame(Choreographer.java:560) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:5835) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)

aditya2592 avatar Feb 15 '16 14:02 aditya2592

I am getting the same error in lollipop with samsung devies like Samsung S5, S6, A3. Anyone with a fix yet?

swatijiet avatar Feb 28 '16 07:02 swatijiet

Pending approval, this commit in my pull request is a bit hacky, but it solves the problem of the global layout listener being called repeatedly until the OOM. I also added both global layout listener removal methods in this commit.

jkreiser avatar Feb 29 '16 14:02 jkreiser