Device Ram

Monkey Forums/Monkey Programming/Device Ram

siread(Posted 2013) [#1]
Is there any way of checking how much memory the device has? Failing that can you tell which device you are actually using (iOS)?


MikeHart(Posted 2013) [#2]
Yes, with native code, wrapped into Monkey functions.


siread(Posted 2013) [#3]
Heh, I guess what I'm asking is has anyone done it already. :D


Nobuyuki(Posted 2013) [#4]
not as far as I'm aware, but device memory is not relevant in any case. Your app is allocated a maximum heap size regardless of system RAM (on Android at least) and you're generally not allowed to exceed it. For many older and lower-specced devices coming from a couple years ago, this usually means 24 megabytes. Aim any higher than that and you risk having your app crash out "mysteriously" on some devices.


AdamRedwoods(Posted 2013) [#5]
Your app is allocated a maximum heap size regardless of system RAM (on Android at least)
if we're speaking specifically Android, you can up the max heap size by using a special manifest parameter. also NDK bypasses the Java heap management, as does opengl texture memory (which is how mojo works).

Anyways, for android you'd need to wrap MemoryInfo class:
http://developer.android.com/reference/android/app/ActivityManager.MemoryInfo.html
iOS:
http://stackoverflow.com/questions/5012886/knowing-available-ram-on-an-ios-device