Large Heap Size Difference Between Emulator and Real Device - android

I am working on and Android app, and have noticed quite a large disparity between the heap size when I use an emulator, and the heap size when I use a real device.
I am using a Nexus 6, and a Nexus 6 emulator to test the app. When I use the real device, my heap size is around 40mb, and allocated is around 23mb.
However, when I use the emulator, my heap doesn't go above 8mb.
Why is there such a large difference?

How large your heap is depends on your device, how much ram it has total and the device manufacturer. You probably set up your emulator with little ram, resulting in that a large heap on the emulator may be smaller than a normal heap on a real device.
Consider this stack overflow post:
Detect application heap size in Android

Related

Application occupying Much Memory on Nexus 4.2.1

In my project I am using a few drawables for creating good looking UI and the strange problem I got is it working good on Kindle Fire with 2.3.4 version properly and occupying just 2.8397MB only, but when I run the same application in nexus 4.2.1 device it is taking 23.45678MB to 30MB and running very slowly, I thought the problem would be on drawables so created 9 Patch for them but still getting same problem.
On pre-honeycomb devices (like the 2.3.4 Kindle Fire) bitmaps are stored in native heap, which doesn't show up when analyzing the dalvik heap memory usage in ddms.
This does not mean that it won't still count against the heap limit, however.
Honeycomb and later devices store bitmaps in the dalvik heap which will show up in ddms. That should explain why the memory usage is much "less" on the Kindle Fire. It isn't, it just appears that way.
Do you have different drawable folder per resolution ? if so, it could be that this is related to the resources you have in the different folders so that the drawables loaded on your Nexus are significantly larger than the ones loaded on your kindle fire (The kindle fire has a 1024x600 resolution while the Nexus 7 has a 1280x800 resolution)

What is the default app heap size on ICS (Android OS4.0)?

I'm trying to make my app ICS-compatible and I'm getting OutOfMemoryErrors that I never got with 2.3.3 and earlier. I don't own an ICS device so I'm using the emulator and I noticed the default heap size is 24M, which is the same as previous versions (on the emulator).
Is 24M the default heap size on actual devices? What about the Google Nexus?
Thanks in advance...
Answering my own question:
I did not find the exact size, in fact it is likely different on different devices, but I can confirm it's bigger than 24Mb after I tested my app on a Google Nexus and didn't get any OOM errors. The emulator probably defaults to 24Mb for all OS versions.

Android devices with small heap

is there a list of android devices and their heap size?
I know how to check programmatically in the app, but I am curious to know.
I have devices with android heaps 32M and greater, and they have at least 512MB RAM. Could I simply assume that all devices with 512MB Ram have 32M of heap? And that devices with less ram have less heap? (16mb? 24mb? ???)
thanks
is there a list of android devices and their heap size?
Not that I am aware of.
Could I simply assume that all devices with 512MB Ram have 32M of heap?
Heap size recommendations are driven more by Android OS release and screen size. Android OS release and screen size also have an impact on minimum effective RAM on the device. So the concepts are loosely correlated, but that's it.
I'd like a list so I could determine mainly if Android 2.2+ devices with 16mb heap exist
AFAIK, you cannot rule out that combination. After all, please remember that Android is open source, so modded ROMs are welcome to configure heap sizes however they want. IIRC, at least one allows the user to choose the heap size. And there are no rules regarding device RAM or heap size in the Compatibility Definition Document, so device manufacturers are welcome to try odd combinations.
Well, you can't assume absolutely anything. There may be a trend like heaps of size 32mb+ on devices with 512mb+ memory. But that's just a trend, not a rule.
There are sofar 4 different types(based on heap size) of android devices.
Those are:
G1----16MB
Droid-24MB
Nexus one-36MB
XOOM-48MB.
XOOM is the device which has highest heap memory.
A source that could help guessing is also if you create emulators. If you create an emulator for Android 1.5, it doesn't automatically adds the "Max VM application heap size" attribut under hardware. But starting with Android 1.6 it sets it automatically to 24 MB. If you choose Android 4.0.3 then it sets it automatically to 48 MB. Maybe that's some kind of typical minimal heap sizes for these Android versions.
EDIT: Just found this: https://stackoverflow.com/a/2634738/1037994. So combining the emulator attribut with this statement, I would guess 24 MB as minimum for Android 2.2+ devices.

Memory/RAM usage on different devices with same app

I made an android game with cocos2d-android.
When I test this game on different devices, the RAM usage is varied:
Samsung Galaxy Note (2.3.5):
Task-Manager show: about 17MB
Watchdog: about 23MB
Debug: about 10MB (Debug.getNativeHeapAllocatedSize() / 1048576L)
Samsung Galaxy I9000 (2.3.3):
Task-Manager: about 55MB
Watchdog: about 42MB
Debug: about 25MB
Emulator (2.3.3 && 3.2):
Debug: about 40MB
I don't have a clue why the memory consumption on different devices of the same game is varied like this. Has anybody an answer?
Each of those devices are running a different version of Android, and are likely running different types of software in the background.
If your not experiencing any problems, and your users aren't complaining - I dont see anything to worry about.
Samsung Galaxy I9000 has a heap size of 64MB. Galaxy Note has a heap size of 128MB. In the emulator a heap size of 24MB is default but of course you can choose any size.
I am still don't know exactly why the ram usage is that much different, but it seems to have something to do with the bitmaps I use for the game. In the newest version I added low resolution bitmaps for low-end devices. If I turn on the low resolution bitmaps on the I9000 the ram usage is decreasing strongly. If I start the game with low-resolution bitmaps on the galaxy note the ram usage decrease is much smaller, nonetheless the game works smooth on both devices with sd and hd graphics and the user feedback in the android market is positive too.

Android Emulator RAM size results in error

As I saw this Post in stackoverflow I tried to Increase RAM size of my device But it results in
Emulator encounters a problem needs to close
I tried wipe user data
My device RAM size specified:1024MB
My PC RAM is 4GB.
Why this happening? Is any other way to increase emulator speed?
In Android Virtual device manager, where you edit your device, specify ram size and don't forget to add unit e.g. MB, Kb etc. otherwise it will crash like that. Example:
1024MB

Categories

Resources