Failed to allocate a 2374572 byte allocation with 1676096 free bytes and 1636KB until OOM

this error is coming while i debugging xamarin form android app in mobile.

some one help me.

Best Answer

  • MommMomm US ✭✭✭
    Accepted Answer

    @GabaSoft, open your Android.manifest file and add android:largeHeap="true" to your application tag.

    But like AlmaJensen said, probably you have some memory leaks issues with images.

Answers

  • GeraldVersluisGeraldVersluis NLUniversity ✭✭✭✭

    Go into your Android project properties, find the Build tab, then the Advanced tab and set the Java heap size to 1G

    Should be resolved then!

  • GabaSoftGabaSoft USMember

    i have done and even changed to 2G that but nothing happened.

  • AlmaJensen.9398AlmaJensen.9398 USMember ✭✭✭

    @GabaSoft Are you dealing with images or maps in the app? Those are areas where I've most commonly run into that issue. I'm trying to remember how to fix another similar issue I ran into. There's another way to increase the java heap space that you do outside of xamarin.

    When getting the out of memory error yes the first thing you should try is what was suggested by @GeraldVersluis a second fallback is you may need to increase the size of the Java vm on your machine. I've only had one project where I had to do this.

    stackoverflow.com/questions/880855/increase-the-java-heap-size-permanently

  • MommMomm USMember ✭✭✭
    Accepted Answer

    @GabaSoft, open your Android.manifest file and add android:largeHeap="true" to your application tag.

    But like AlmaJensen said, probably you have some memory leaks issues with images.

  • GabaSoftGabaSoft USMember

    @Momm, thank you so much , it worked.
    @AlmaJensen.9398 and @GeraldVersluis , thank you for suggestion.

    but i am not using any image. actually i have a list with some text, that was creating error.
    but after adding android:largeHeap="true" in manifest file, it worked.

  • NMackayNMackay GBInsider, University mod

    @GabaSoft

    out of interest and you using Forms 2.1.0 (stable) or a 2.2.x beta build?

  • GabaSoftGabaSoft USMember

    @NMackay i am using Form 2.1.0 stable

  • GerryHGerryH USMember ✭✭✭

    Momm, I can't find any information about "probably you have some memory leaks issues with images"

    How can one clean up image memory?

  • Abhijeet_SuryaAbhijeet_Surya USMember ✭✭✭

    @Momm said:
    @GabaSoft, open your Android.manifest file and add android:largeHeap="true" to your application tag.

    But like AlmaJensen said, probably you have some memory leaks issues with images.

    After taking this step, app is not crashing, but it wont display the image.

    I am creating images dynamically & it is taken from user camera. (Facing this issue only on lollipop & only using back camera )

  • pratiuskumardubeypratiuskumardubey USMember ✭✭

    I have already added the following objects(Java Max Heap Size to 1G and android:largeHeap="true") in android manifest file.
    But still i'm getting below Error and App crash on every step.

    **Xamarin caused by: java.lang.OutOfMemoryError: Failed to allocate a 10394188 byte allocation with 4194304 free bytes and 5MB until OOM
    dalvik.system.VMRuntime.newNonMovableArray(Native Method)
    android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
    android.graphics.BitmapFactory.decodeStream()BitmapFactory.java:609
    android.graphics.BitmapFactory.decodeResourceStream()BitmapFactory.java:444
    android.graphics.BitmapFactory.decodeResource()BitmapFactory.java:467
    android.graphics.BitmapFactory.decodeResource()BitmapFactory.java:497
    **
    If anyone having any clue or fact for resolve this issue, Please help me on this.

Sign In or Register to comment.