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.

Reply via email to