[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-nio-dev
Subject:    Re: Early review on NIO Stream APIs
From:       Alan Bateman <Alan.Bateman () oracle ! com>
Date:       2013-02-08 19:40:23
Message-ID: 511554A7.901 () oracle ! com
[Download RAW message or body]

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.

-Alan.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic