I think I know why it is "not full[sic] proof". Some time ago, I carefully read and compared side by side the Java Sun Javadoc description of System.gc() and Android's. One shocking difference emerged. In both, the call is only a hint, but in Android, it is a much weaker hint: unlike in Sun, you are not even guaranteed that the garbage collection is called at all! With Sun, you are at least guaranteed that it was called, and an effort made to release SOME memory, even if that effort is unsuccessful.
On Apr 27, 12:12 pm, Streets Of Boston <[email protected]> wrote: > Using System.gc() helped me with my image editing program. > But it is NOT full proof. > > This is what I do: > When ma app no longer needs (a) bitmap(s), it calls *recycle()* (this will > clean up the memory - image data - that is part of your process, but not > part of the DalvikVM), nulls the Bitmap(s) references and calls System.gc(). > > (Pre Android 3.0), bitmap memory (the memory holding the raw image data) is > not 'seen' by the DalvikVM. It may not know that your app is running low on > memory and it won't call the garbage collector to try to reclaim some memory > before allocating it --> OOM that was not really necessary. -- 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

