lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: IndexSearcher memory leak?
Date Thu, 06 Jul 2006 00:55:08 GMT
: I get an OutOfMemoryException after a few iterations of the following loop:
:  	ramdir = new RAMDirectory( "path/to/my/directory" );
: 	searcher = new IndexSearcher( reader );
: TermQuery( new Term( "field", "keyword")));
:         searcher.close();
:         ramdir.close();
: Note, ramdir and searcher are both instance variables.

But what is "reader" ?  .. where is it initialized ?

I'm guessing this isn't hte exact code that gives you an OOM (since there
seems to be some code missing)

if you can post a complete small example program (with main method) that
demonstrates this problem -- or even better a self contained JUNit test --
then people can try to reproduce it.

(if the root of the issue is opening a RAMDirectory based on an
FSDirectory you can create the on disk directory using the system tmpdir
in your JUnit setUp method)

I suspect that somewhere in there you have another line that looks like...

     reader = ramdir );

...and that may be causing your problem.   If you open an IndexReader
explicitly, then IndexSearcher.close() won't close it for you


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

View raw message