Contrary to what @bigstones says, onLowMemory()
doesn't exactly do what you would expect. My understanding of this call is that it is only reached when the system is low on memory and asks your application to free extra memory. onLowMemory()
will never be called when the system has plenty of memory, but your app has reached its memory limit.
It's also a bad idea to try/catch the OutOfMemory exceptions. If you want to know your own app's memory usage, the best way to get it is via the ActivityManager class, namely in the getMemoryClass()
and getProcessMemoryInfo()
methods.
Also, you should read this SO answer (from an Android engineer), which explains process memory use in a much more detailed way.