potato
potato

Reputation: 4609

acceptable libgdx memory consumption

I have a newbie question. This is a screenshot of Memory tab in Android studio. Can someone provide some approximate data about what is an acceptable memory consumption? Are there boundaries limiting max memory usage? Should I be worried if allocated memory is around 11Mb?

enter image description here

Upvotes: 1

Views: 616

Answers (1)

Kristy Welsh
Kristy Welsh

Reputation: 8392

It does seem like you don't have much free memory and that the allocated memory should be more. I had the same problem and it was because I was not closing my cursors properly and also because I was not recycling the bit map memory for graphics I was getting from files instead of from the drawable resources. You can tell how much memory you have available to your app:

    ActivityManager am = (ActivityManager)getSystemService(ACTIVITY_SERVICE);
    int memoryClass = am.getMemoryClass();
    Runtime rt= Runtime.getRuntime();
    long maxMemory = rt.maxMemory();
    long freeMemory = rt.freeMemory();
    Log.d("Memory Available", "memoryClass:" + Integer.toString(memoryClass));
    Log.d("Max Memory Available", "max memory:" + Long.toString(maxMemory));
    Log.d("Free Memory", "Free Memory: " + Long.toString(freeMemory));

Upvotes: 2

Related Questions