lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Ganyo <>
Subject RE: CachedSearcher
Date Tue, 16 Jul 2002 14:40:43 GMT
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

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.


> -----Original Message-----
> From: Halácsy Péter []
> Sent: Tuesday, July 16, 2002 12:43 AM
> To: Lucene Users List
> Subject: RE: CachedSearcher
> > -----Original Message-----
> > From: Doug Cutting []
> > 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.
> (If a lot of searcher is requested ant a writer is always 
> modificating the index). 
> peter
> --
> To unsubscribe, e-mail:   
> <>
> For additional commands, e-mail: 
> <>

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message