Android Question is Out Of Memory ?

Discussion in 'Android Questions' started by peacemaker, Jan 30, 2015.

  1. peacemaker

    peacemaker Well-Known Member Licensed User

    How to understand that your app is near the crash due to OutOfMemory ?

    Thanks to Informatix, that shared the sub:
    Code:
    Sub GetFreeMem As Float
       
    Dim r As Reflector
       
    Dim MM, TM, FM, Total As Int
       r.Target = r.RunStaticMethod(
    "java.lang.Runtime""getRuntime"NullNull)
       MM = r.RunMethod(
    "maxMemory")
       FM = r.RunMethod(
    "freeMemory")
       TM = r.RunMethod(
    "totalMemory")
       Total = MM + FM - TM
       
    Return Total / 1024
    End Sub
    I have tried some times:
    Code:
    MaxMemory_FreeMemory_TotalMemory:
    Android 
    4.0 512 MB RAM: 128_0.15_11.07
    Android 
    4.2 1GB RAM: 256_0.02_10.0
    Android Emulator BlueStacks 
    4.4 768 MB RAM: 512_2.72_17.4
    If to measure after start my app - difference is about 10240. So, it's used by my app. I guess, it's 10 MB ... :)
    And i have and had no issue with OutOfMemory errors.

    But Google Analytics reports show that many user's devices with 1 GB RAM generate OutOfMemory app hungs (not for bitmaps directly, in subs
    OutOfMemoryError (@httpjob....) and others working with data objects).

    So, how to correctly understand that RAM is so out that app can be stopped any next second ?
    What digits are the limit ? For any device.

    Does it mean that those devices with errors have result Total = MM + FM - TM that is some small digit (say < 1 MB), many apps are loaded and cannot be freed\unloaded by the OS ?
     
    Last edited: Jan 30, 2015
  2. Erel

    Erel Administrator Staff Member Licensed User

    Do you have access to any crash logs?
     
  3. peacemaker

    peacemaker Well-Known Member Licensed User

    No, just Analytics logs, attached TempDownload.png

    Question is how to check\calculate memory status, that we are going to the crash.

    BTW, i have found that UnsupportedOperationException (@GLES20Canvas) error under Android 4.0.x is kind of the OOM error !

    If to restart the app several times on the same device - sometimes app start OK without UnsupportedOperationException (@GLES20Canvas) error, and mostly - with this error, and firstly got FreeMemory amout by Informatix code sample - is around 0.0x MB value. But not stable to understand what the limit is.

    When no error FreeMemory is always > 0.7 MB.
     
    Last edited: Feb 1, 2015
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