java.lang.OutOfMemoryError

tip

Try adding these lines to your manifest: "android:hardwareAccelerated="false"" and "android:largeHeap="true"" as it seems to work for some cases. See also this article about handling bitmaps on android's documentation: https://goo.gl/8LVrzp

tip

Try adding these lines to your manifest: "android:hardwareAccelerated="false"" and "android:largeHeap="true"" as it seems to work for some cases. See also this article about handling bitmaps on android's documentation: https://goo.gl/8LVrzp

tip

Try adding these lines to your manifest: "android:hardwareAccelerated="false"" and "android:largeHeap="true"" as it seems to work for some cases. See also this article about handling bitmaps on android's documentation: https://goo.gl/8LVrzp

tip

Try adding these lines to your manifest: "android:hardwareAccelerated="false"" and "android:largeHeap="true"" as it seems to work for some cases. See also this article about handling bitmaps on android's documentation: https://goo.gl/8LVrzp

tip

Try adding these lines to your manifest: "android:hardwareAccelerated="false"" and "android:largeHeap="true"" as it seems to work for some cases. See also this article about handling bitmaps on android's documentation: https://goo.gl/8LVrzp

tip

Try adding these lines to your manifest: "android:hardwareAccelerated="false"" and "android:largeHeap="true"" as it seems to work for some cases. See also this article about handling bitmaps on android's documentation: https://goo.gl/8LVrzp

tip

Try adding these lines to your manifest: "android:hardwareAccelerated="false"" and "android:largeHeap="true"" as it seems to work for some cases. See also this article about handling bitmaps on android's documentation: https://goo.gl/8LVrzp

tip

This was issue #159 in Fresco, and was fixed recently, in v1.3.0.

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • I got OutOfMemory with this code. Steps to reproduce: 1. Create default Alloy project 2. Load and save big image to the assets 3. Add this test code to the click event handler 4. Click several times to the view with click event attached 5. See result in log Image: https://static.pexels.com/photos/479/landscape-nature-sunset-trees.jpg {code:javascript|title=test code} var iv = Ti.UI.createImageView({ width : Ti.UI.SIZE, height : Ti.UI.SIZE, image : '/images/landscape-nature-sunset-trees.jpg' }); var blob = iv.toBlob(); iv.image = null; iv = null; Ti.API.info('OK!'); {code} {code:text|title=error log} [ERROR] TiDrawableReference: (KrollRuntimeThread) [6078,6078] Unable to load bitmap. Not enough memory: Failed to allocate a 23887884 byte allocation with 8219096 free bytes and 7MB until OOM [ERROR] TiDrawableReference: java.lang.OutOfMemoryError: Failed to allocate a 23887884 byte allocation with 8219096 free bytes and 7MB until OOM [ERROR] TiDrawableReference: at dalvik.system.VMRuntime.newNonMovableArray(Native Method) [ERROR] TiDrawableReference: at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) [ERROR] TiDrawableReference: at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609) [ERROR] TiDrawableReference: at org.appcelerator.titanium.view.TiDrawableReference.getBitmap(TiDrawableReference.java:348) [ERROR] TiDrawableReference: at org.appcelerator.titanium.view.TiDrawableReference.getBitmap(TiDrawableReference.java:300) [ERROR] TiDrawableReference: at ti.modules.titanium.ui.widget.TiUIImageView.toBlob(TiUIImageView.java:947) [ERROR] TiDrawableReference: at ti.modules.titanium.ui.ImageViewProxy.toBlob(ImageViewProxy.java:93) [ERROR] TiDrawableReference: at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method) [ERROR] TiDrawableReference: at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62) [ERROR] TiDrawableReference: at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:918) [ERROR] TiDrawableReference: at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1141) [ERROR] TiDrawableReference: at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:356) [ERROR] TiDrawableReference: at android.os.Handler.dispatchMessage(Handler.java:98) [ERROR] TiDrawableReference: at android.os.Looper.loop(Looper.java:148) [ERROR] TiDrawableReference: at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:118) {code}
    via by Andrey Tkachenko,
  • I got OutOfMemory with this code. Steps to reproduce: 1. Create default Alloy project 2. Load and save big image to the assets 3. Add this test code to the click event handler 4. Click several times to the view with click event attached 5. See result in log Image: https://static.pexels.com/photos/479/landscape-nature-sunset-trees.jpg {code:javascript|title=test code} var iv = Ti.UI.createImageView({ width : Ti.UI.SIZE, height : Ti.UI.SIZE, image : '/images/landscape-nature-sunset-trees.jpg' }); var blob = iv.toBlob(); iv.image = null; iv = null; Ti.API.info('OK!'); {code} {code:text|title=error log} [ERROR] TiDrawableReference: (KrollRuntimeThread) [6078,6078] Unable to load bitmap. Not enough memory: Failed to allocate a 23887884 byte allocation with 8219096 free bytes and 7MB until OOM [ERROR] TiDrawableReference: java.lang.OutOfMemoryError: Failed to allocate a 23887884 byte allocation with 8219096 free bytes and 7MB until OOM [ERROR] TiDrawableReference: at dalvik.system.VMRuntime.newNonMovableArray(Native Method) [ERROR] TiDrawableReference: at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) [ERROR] TiDrawableReference: at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609) [ERROR] TiDrawableReference: at org.appcelerator.titanium.view.TiDrawableReference.getBitmap(TiDrawableReference.java:348) [ERROR] TiDrawableReference: at org.appcelerator.titanium.view.TiDrawableReference.getBitmap(TiDrawableReference.java:300) [ERROR] TiDrawableReference: at ti.modules.titanium.ui.widget.TiUIImageView.toBlob(TiUIImageView.java:947) [ERROR] TiDrawableReference: at ti.modules.titanium.ui.ImageViewProxy.toBlob(ImageViewProxy.java:93) [ERROR] TiDrawableReference: at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method) [ERROR] TiDrawableReference: at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62) [ERROR] TiDrawableReference: at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:918) [ERROR] TiDrawableReference: at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1141) [ERROR] TiDrawableReference: at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:356) [ERROR] TiDrawableReference: at android.os.Handler.dispatchMessage(Handler.java:98) [ERROR] TiDrawableReference: at android.os.Looper.loop(Looper.java:148) [ERROR] TiDrawableReference: at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:118) {code}
    via by Andrey Tkachenko,
  • First time in android studio
    via Stack Overflow by Nick Dettore
    ,
  • Java.lang.outofMemory Error
    via Stack Overflow by Sir George
    ,
  • GitHub comment 484#108872965
    via GitHub by russellhoff
    ,
  • java.lang.OutOfMemoryError
    via GitHub by lkw103037
    ,
  • GitHub comment 1171#243378433
    via GitHub by IRMobydick
    ,
  • Out of memory exception
    via GitHub by SachinRana028
    ,
  • image not loading
    via GitHub by jackbelicec
    ,
    • java.lang.OutOfMemoryError: Failed to allocate a 23887884 byte allocation with 8219096 free bytes and 7MB until OOM at dalvik.system.VMRuntime.newNonMovableArray(Native Method) at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609) at org.appcelerator.titanium.view.TiDrawableReference.getBitmap(TiDrawableReference.java:348) at org.appcelerator.titanium.view.TiDrawableReference.getBitmap(TiDrawableReference.java:300) at ti.modules.titanium.ui.widget.TiUIImageView.toBlob(TiUIImageView.java:947) at ti.modules.titanium.ui.ImageViewProxy.toBlob(ImageViewProxy.java:93) at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method) at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62) at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:918) at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1141) at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:356) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:148) at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:118)

    Users with the same issue

    Unknown visitor
    Unknown visitor2 times, last one,
    dmitrydmitry
    1 times, last one,
    balajivaishnavbalajivaishnav
    1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    filpgamefilpgame
    8 times, last one,
    66 more bugmates