Android Question Out Of Memory Error

Discussion in 'Android Questions' started by Big Dave, Mar 8, 2015.

  1. Big Dave

    Big Dave Member Licensed User

    Hello

    I have successfully run an app on one tablet and am now in the process of porting it to a different tablet. I have encountered an out of memory error


    java.lang.OutOfMemoryError

    at android.graphics.Bitmap.nativeCreate(Native Method)
    at android.graphics.Bitmap.createBitmap(Bitmap.java:809)
    at android.graphics.Bitmap.createBitmap(Bitmap.java:786)
    at android.graphics.Bitmap.createBitmap(Bitmap.java:753)
    at anywheresoftware.b4a.objects.drawable.CanvasWrapper.Initialize(CanvasWrapper.java:76)
    at b4a.konn2.kon11._vvvvvvvvvvvvvvvvvvv7(kon11.java:1301)
    at b4a.konn2.kon11._activity_create(kon11.java:381)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
    at b4a.konn2.kon11.afterFirstLayout(kon11.java:100)
    at b4a.konn2.kon11.access$100(kon11.java:17)
    at b4a.konn2.kon11$WaitForLayout.run(kon11.java:78)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:149)
    at android.app.ActivityThread.main(ActivityThread.java:5097)

    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:610)
    at dalvik.system.NativeStart.main(Native Method)

    No idea what has caused the problem but in my browsing the forum I have a couple of questions that may go some way to answer it

    1. In Activity_Create what sort of things should be in "If FIRSTTIME then...." coding. I have a number of mediaplayer and timer initialisations that are run every time Activity_Create is run.
    2. I have a mediaplayer load instruction that runs immediately before an ActivityStart and is used within that activity. This activity can be called many times during the course of running the app.

    Is it likely that my poor positioning of certain instructions causes them to use more and more memory leading to my out of memory errors.

    Thanks for looking.
     
  2. KZero

    KZero Active Member Licensed User

    it seems you are loading big or many bitmaps

    post the relevant code of how you load the bitmaps
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice