lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "장용석" <>
Subject Re: Lucene Memory Leak
Date Thu, 04 Sep 2008 01:04:33 GMT
In fact, I think that the important reasons are Directory class and Analyzer
If you don't want IndexSearcher class keep open for the entire life of a web
application, you can do it.
I think It will not cause memory leak problem.
But, Directory and Analyzer classes can cause the problem if they new
created by method call every time. I think...
Only keep two classes Directory and Analyzer by singlton and do test. :)

2008/9/4, Andy33 <>:
> I took your advice and created Singletons for the Directory, Analyzer, and
> IndexSearcher classes. I also undid the closing of the Directory and
> IndexSearcher. This seemed to fix my memory leak problem. However, I don't
> like the fact that I am leaving open the IndexSearcher for the entire life
> of a web application. When I close the IndexSearcher, the underlying
> IndexReader is also closed. It looks like the only way I can reopen the
> IndexSearcher is to reopen the IndexReader and create a new IndexSearcher.
> This leads me back to my original problem.
> Is there a better way to handle this rather than keeping the IndexSeacher
> open for the life of the application?
> 장용석 wrote:
> >
> > I think when your doQuery method is run, Directory and Analyzer classes
> > are
> > new create every time.
> > If index file's size is very large then create new Directory instance is
> > pressure to jvm and it takes long time for create new Directory instance.
> > I suggest that modify the code , Analyzer class and Directory class that
> > singletone pattern.
> > (If you can....Search Class,too)
> >
> --
> View this message in context:
> Sent from the Lucene - Java Users mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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