While the attempts to free the Java array memory associated with a 
BufferedImage with explicit method calls were in vain, I wanted to counter some 
unnecessarily general comments here.

> > I am having problems reclaiming memory consumed by
> a
> > (supposedly  
> > GC'ed) BufferedImage. When I want to dispose of an
> > image, I basically  
> > do:
> > 
> 
> That's because in Java you never explicitly reclaim
> memory.

This is true for Java heap memory (memory allocated with the new operator), but 
not for other platform and C heap memory allocated by the Java libraries to 
support some operations on Java objects.  For the most part we try to keep such 
non-Java-heap memory usage to a minimum, but in the case of images we can use 
non-Java-heap memory in a few places.  In most, if not all, cases where the 
libraries use platform memory to facilitate the Java object operations there is 
usually an explicit dispose() method call to free the underlying resources 
aggressively and it is typically backed up with some form of finalization to 
make sure the resources are reclaimed even if regular garbage collection is 
relied upon.

But, the point that I wanted to make is that there are some cases where the 
developer can explicitly participate in resource reclamation even in a fully 
garbage-collected environment.

> > img.flush();
> > img = null;
> 
> Nice, but rather pointless.

These are not pointless for VolatileImage, Toolkit, and some BufferedImage 
images as I pointed out in a prior post.  This call can and does free some 
system resources, notably VRAM resources.

It will not, however, free the primary Java array associated with a 
BufferedImage which was the original intent of the thread.
[Message sent by forum member 'flar' (flar)]

http://forums.java.net/jive/thread.jspa?messageID=247245

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to