Android Memory Leak, No Static Variables
I'm a beginning Android developer, and as a practice project, I'm trying to make and activity which can take a picture, save it to the external storage, and display it in an ImageV
Solution 1:
While displaying bitmap we should be careful that its size does not exceed the Heap size or say VM Budget. Although you do not have any memory leak but when you have changing your orientation then may be its taking some time to clean previously loaded bitmap so you get memory overflow error. For avoiding this error please read this How to display bitmap efficiently
Solution 2:
Try analyze your app's memory to find where the leaks are, here are some links: link1, link2
You can also try manually release the previous Activity's Bitmap by removing it from your ImageView and calling Bitmap.recycle() when your Activity's onStop() is called, since pre Honycomb the time that a Bitmap's backing buffer can be released is quite indeterministic.
Post a Comment for "Android Memory Leak, No Static Variables"