Early review on NIO Stream APIs

Alan Bateman Alan.Bateman at oracle.com
Fri Feb 8 19:40:23 UTC 2013

On 08/02/2013 12:09, Ulf Zibis wrote:
> :
> Do those streams close automatically from finalize() method, if 
> released to GC, e.g. by nulling the referencing variable? ...and if 
> not, why?
> -Ulf
We don't use finalizers in this area. Aside from the overhead, the other 
issue here is that file descriptors are a relatively scarce resource so 
if the application is not closing files or channels then you'll often 
run out of file descriptors long before you run out of memory.

In any case, I think try-with-resources should be very useful here.


More information about the core-libs-dev mailing list