I want to increase the default virtual memory heap size of my avd. I am using Eclipse 3.7.2 for development and when I create (or edit) a avd I set the “Max VM application heap” to 64MB. If I select Details it confirms this and if I inspect the config.ini file i see that “vm.heapSize=64” which is correct. The problem is that this is not actually true when running the avd.
In my application I run “Runtime.getRuntime().maxMemory();” which shows 24MB!!!!
Likewise,
ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
int memoryClass = am.getMemoryClass();
Shows 24MB
UPDATE: I noticed that in hardware-qemu.ini the “vm.heapSize=24” ? I changed the value to 64, but when I launch the avd it gets changed back to 24?
UPDATE: totalMemory() returns ~15MB
UPDATE: ADT version is 20.0.1
UPDATE: I have tested this a bunch, making many different AVDs with many different settings and all I can conclude is that the AVD or Eclipse is a bit buggy and often does not reflect the settings values you enter for the AVD. Note that I have made AVD devices that do reflect vm.heapSize=64.
Based on this Google Groups question and my interpretation of the documentation sounds like those values would be fore your application only and not the entire emulator.
I would be curious to see if
totalMemory()would return 64m. Here is the documentation.Edit: getMemoryClass() according to the documentation:
Which boils down to there is no programmatic way that I can find to get the heap size of the emulator (device).
Edit 2: I think you may be able to find your answer here as well. – Android How do you get total memory RAM in the device?
Good luck.