You really can't. You can look in /proc/meminfo for the kernel's numbers. "MemFree" and "Cached" are the most useful ones there, which together give an indication how much could possibly be free... but ideally MemFree is small, and Cached is in use but some part of it can actually be used for other things if needed, but how much of that actually can is not going to be clear -- basically as it gets smaller, things will start running more slowly as more paging happens, but exactly when and where that starts impacting things enough that you care... well.
On top of that, Android tries to keep as many application processes running as it can, even though they may not be absolutely needed. So you will see the system consistently having a lot of memory really in use, but in fact if there are memory demands from more important processes, the less important ones can be killed to reclaim memory for them. So all of this information is somewhat useful for trying to debug the overall behavior of the system, but really not useful for applications. The main thing we have is the onLowMemory() callback, to tell applications to free memory if they can. This is called when the system detects that all of the extraneous background processes have been killed, and it would really like to have some memory freed up before more important processes need to be terminated. -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them. --~--~---------~--~----~------------~-------~--~----~ unsubscribe: [email protected] website: http://groups.google.com/group/android-porting -~----------~----~----~----~------~----~------~--~---
