After you call bitmap.recycle(), you can no longer use that bitmap at all. 
After calling recycle(), the bitmap still occupies a tiny little bit of 
memory in the DalvikVM. All its raw pixel data memory has been released, 
though. To release that tiny little bit of memory in the DalvikVM as well, 
release the reference to the bitmap (e.g. by doing 'bitmap = null' or by 
just exiting the Java-block that contains 'bitmap' as a local variable) and 
the garbage collector will clean it up later.

When you don't call 'recycle()', the garbage collector will call 
'recycle()' when the bitmap is garbage collected (through the bitmap's 
finalize() method). But since you can't control the garbage collector 
consistently across all types of devices/implementations, calling 
'recycle()' yourself will make sure that the raw pixel data is released at 
your convenience. 

On Thursday, April 19, 2012 9:11:01 AM UTC-4, Spooky wrote:
>
> Re-stating (in clearer terms...I think) one remaining question (I think
> I have my answer for the rest---we'll see).
>
> Let's say I have a method which is used frequently to do some work on
> bitmaps.  If, during that method, I create a temporary bitmap, and then
> recycle it, and don't touch it for the remainder of the time in that
> pass through that method, but then use it again (and recycle it again)
> in anoother pass through that same method, does that then attempt to
> re-use the bitmap I recycled in the previous pass?  Or is a new copy
> created and recycled in each pass?
>
> And, along with that, once I leave that method, and the temporary
> bitmap that's local to that method has not been recycled, is its
> memory freed up?  Or does it continue to chew up memory?
>
> Thanks,
>    --jim
>
> -- 
> THE SCORE:  ME:  2  CANCER:  0
> 73 DE N5IAL (/4)        MiSTie #49997  < Running FreeBSD 7.0 >
> spooky1...@gmail.com ICBM/Hurricane: 30.44406N 86.59909W
>
>       "'Wrong' is one of those concepts that depends on witnesses."
>      --Catbert:  Evil Director of Human Resources (Dilbert, 05Nov09)
>
> Android Apps Listing at http://www.jstrack.org/barcodes.html
>
>

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

Reply via email to