I'd like to see the finalize() methods removed from Lucene entirely.  In a
system with heavy load and lots of gc, using finalize() causes problems.  To
wit:

1) I was at a talk at JavaOne last year where the gc performance experts
from Sun (the engineers actually writing the HotSpot gc) were giving
performance advice.  They specifically stated that finalize() should be
avoided if at all possible because the following steps have to happen for
finalized objects:
  a) register the object when created
  b) notice the object when it becomes unreachable
  c) finalize the object
  d) notice the object when it becomes unreachable (again)
  e) reclaim the object

This leads to the following effects in the vm:
  a) allocation is slower
  b) heap is bigger
  c) gc pauses are longer

The Sun engineers recommended that if you really do need an automatic clean
up process, that Weak references are *much* more efficient and should be
used in preference to finalize().

2) External resources (i.e. file handles) are not released until the reader
is closed.  And, as many have found, Lucene eats file handles for breakfast,
lunch, and dinner.

Scott

> -----Original Message-----
> From: Halácsy Péter [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 16, 2002 12:43 AM
> To: Lucene Users List
> Subject: RE: CachedSearcher
> 
> 
> 
> 
> > -----Original Message-----
> > From: Doug Cutting [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, July 16, 2002 1:00 AM
> > To: Lucene Users List
> > Subject: Re: CachedSearcher
> > 
> > 
> > Why is this more complicated than the code in demo/Search.jhtml 
> > (included below)?  FSDirectory closes files as they're GC'd, so you 
> > don't have to explicitly close the IndexReaders or Searchers.
> 
> I'll check this code, but I think it could hang up with a lot 
> of opened IndexReader.
> http://developer.java.sun.com/developer/TechTips/2000/tt0124.html
> 
> (If a lot of searcher is requested ant a writer is always 
> modificating the index). 
> 
> peter
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 

Reply via email to