开发者

Available app's memory during execution

How do I know how much memory is available for my app on the fly? My app downloads some bitmaps and saves (in memory) them so not to b开发者_开发问答ug the user by downloading it again. But the Java's heap is only 16MB, as far as I know, so I will need to handle some low memory cases and throw away some downloaded bitmaps (not all the bitmaps are shown at the same time, but they might be visible to the user with a single "click", if they are already downloaded).

Is there a way to get the actual available memory (which means, the Java heap available memory)?


A blog on Android memory

http://codelog.dexetra.com/post/47690459692/getting-around-android-memory-blues

check it out ..it may help u..


Instead of worrying about all this, consider wrapping the object that represents each image in a WeakReference. Then just do caching with Map<String, WeakReference<Image>> or however you are doing it.

This way, if it's already in the cache, use it. If it's not in the cache (either it has never been accessed before or it's been GC'd) then get it again.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜