4

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

CQM
  • 36,672
  • 69
  • 214
  • 357
  • 1
    FYI, my own experience (YMMV) is that a program that runs in 16MB on one device/OS version may run out of heap on another. Specifically, if I set my Nexus One running CM7 (2.3.3) to use a 16MB heap (normal for that device is 32MB), a program I've been testing will run out of heap and crash under certain circumstances. OTOH, if I set a Droid running CM6 (2.2.1) to that same heap value (normal heap = 24MB), it runs that same APK just fine. The lesson might be that testing each device using a typical heap size, where "typical" is what getMemoryClass() returns, will support *most* devices. – Carl Nov 19 '12 at 06:28
  • Another per-device variable that affects memory consumption is the display, and whether ldpi, mdpi, or hdpi resources get selected. That's probably not the reason for the Droid/N1 difference listed above, since the Droid actually has a few more pixels than the N1 (so that is probably the OS). But for some devices your memory requirements could be dramatically lower, even with the same OS. So looking to see whether any devices have less than 16MB is only part of the issue, the other part being that 16MB may go further on one device than another, even for the same APK. – Carl Nov 19 '12 at 06:34

4 Answers4

3

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.

CommonsWare
  • 910,778
  • 176
  • 2,215
  • 2,253
  • Yes. In fact, the Cyanogen mod for Android 2.3.3 that runs on the Nexus One phone allows users to choose a heap size all the way down to 12 MB. Although, as a developer, I think anyone who chooses such a non-standard size should expect trouble, and I, for one, and going to give it to them :-) Seriously, since, as you say, there's no real minimum, we have to choose a level we're going to support and let users deal with it if they set it lower. 16 MB should be pretty safe for most apps. – Carl Nov 19 '12 at 06:11
  • @Carl Now, in 2014, Android documentation says: "the baseline Android memory class is 16 (which happens to be the Java heap limit of those devices); some device with more memory may return 24 or even higher numbers." http://developer.android.com/reference/android/app/ActivityManager.html#getMemoryClass() – akauppi Apr 09 '14 at 14:09
  • @akauppi: Well, that makes it official, then - most apps will be OK if they can run using no more than 16 MB of heap. I would point out that the documentation that you reference is for getMemoryClass(), while the actual heap size is returned by maxMemory(). The difference is explained here: http://stackoverflow.com/questions/2630158/detect-application-heap-size-in-android/9428660#9428660 – Carl Apr 09 '14 at 23:20
  • Yes, actual heap is from maxMemory(). However, in the beginning of the Activity it always seems to return precisely what the selected heap class indicates. – akauppi Apr 11 '14 at 07:56
1

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.

Community
  • 1
  • 1
Dude
  • 592
  • 2
  • 7
  • 24
1

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.

inazaruk
  • 72,103
  • 23
  • 181
  • 156
  • exactly, I don't want to assume. But I also don't want to hardcode conditional statements depending on heap size if the mystery device it would apply to does not exist. I'd like a list so I could determine mainly if Android 2.2+ devices with 16mb heap exist – CQM Dec 10 '11 at 23:07
  • I've today suggested adding this info to the Android Dashboard (feel that it would fit right in there): http://developer.android.com/about/dashboards/index.html?utm_source=ausdroid.net – akauppi Apr 09 '14 at 14:11
1

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.

Aliaksei Kliuchnikau
  • 13,099
  • 4
  • 52
  • 66
sab
  • 39
  • 3
  • 1
    The Evo3D (and therefore Evo4g) have 48mb of heap – CQM Jan 21 '12 at 22:45
  • I believe the typical value for Nexus One is actually 32 MB. G1 and Droid seem correct - not sure about the Xoom. The way I judge what is "typical" is by what getMemoryClass() returns, and for Nexus One that value is 32. For more information please see: http://stackoverflow.com/questions/2630158/detect-application-heap-size-in-android/9428660#9428660 – Carl Nov 19 '12 at 06:15