I have an application that allows the user to add many bitmap images
onto the screen (think of lots of picture frame widgets).  If the
applications memory is getting close to reaching its 16MB limit, I
would like to stop the user from adding more images to the
application.  The scenario is much simplified for purposes of brevity,
but basically, I would like to monitor my apps memory usage.

I wrote a watchdog monitor thread that uses android.os.Debug info and
uses the getNativeFreeHeapSize() method to check how much native heap
is remaining (since Bitmap allocations count toward the native heap
and not the Dalvik heap).  This does seem to work, but I was wondering
about all of the other methods out there of monitoring the process/
dalvik/native memory usage.  Then there is the System wide memory
usage.

There is Runtime.getRuntime(), ActivityManager.MemoryInfo,
Debug.MemoryInfo, and then Debug.  What is the optimal mix/match of
these api's that will give me the best view of my applications memory
usage so I can pre-emptively do something about it.

Unfortunately, the activity or applications onLowMemoryWarning()
method does not seem to be triggered which is really what I would have
liked, hence this request.

regards,
Nik


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to