On Thu, Apr 19, 2012 at 06:32:15AM -0700, Streets Of Boston wrote:
> 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.

Now, here's the question:  if I return to this method, and re-use the
locally-created bitmaps that are local to that method, is that considered
re-using a bitmap that's already been recycled?  Or is that a fresh chunk
of memory?

> 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. 

That definitely matches my understanding.  Cool.

Thanks,
   --jim

-- 
THE SCORE:  ME:  2  CANCER:  0
73 DE N5IAL (/4)        | DMR: So fsck was originally called
spooky1...@gmail.com    |      something else.
< Running FreeBSD 7.0 > | Q:   What was it called?
ICBM / Hurricane:       | DMR: Well, the second letter was different.
   30.44406N 86.59909W  |    -- Dennis M. Ritchie, Usenix, June 1998.

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