Reading SystemInfo.systemMemorySize seems to give a believable number, but what exactly is it telling us on Android? The total RAM of the device, or what it thinks is free?
Can you compare the number to the total RAM you know to be on your device? If its the same then its obviously a total, as there is no way you will ever have 100% of the memory available.
Based on the Unity reference and the way it is worded, I would assume its a total, not free:
It gives me “325” on a samsung vibrant, which is a 512MB device. Will be able to test on a few more devices in the morning, but I’m hoping to hear some kind of official answer rather than having to guess at what this value means by inferring it from observation on a few devices.
I see, yeah, that is not very clear. Any Unity folks listening have a more official answer?
IIRC (I don’t have the source in front of me) it reports the total memory as listen by /proc/meminfo.
Without knowing exactly the setup on the Vibrant it could be that 325 of those 512 are mapped as “normal” memory and that the rest is used for other stuff like graphics resources and reserved kernel area.
Thanks for the info, Erique. At least that means it doesn’t change, so it seems suitable for the purpose that I had in mind which is to choose whether to use some lower res textures based on the device’s memory. This has fixed a crash we had on Moto Droid devices (but no crash on higher memory devices).
FWIW, some other devices’ return values for this are:
Moto Droid: 225
Nexus One: 385
Samsung Vibrant: 325