lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <>
Subject Re: Lucene's finalizeable objects
Date Fri, 20 Feb 2004 16:49:00 GMT
Eric Isakson wrote:
> These all look appropriate to me. These finalizers protect against a program consuming
system resources if a programmer forgets to call close and the object gets garbage collected.
This is similar to the handling by and see:

I never noticed that.  Thanks for pointing it out!  The presence of this 
probably makes Lucene's finalize() methods redundant, doesn't it?

> In a perfect world, these wouldn't be needed and people would always call close before
the objects become unreachable.

Having to call close() is like malloc/free or new/delete in C and C++, 
i.e., in an ideal world we shouldn't have to call them.  It's only 
required here because the OS isn't integrated with Java's GC.  But 
finalize() provides the hook to perform this integration.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message