After reading this forum post : http://www.nabble.com/Lucene-Memory-Leak-tt19276999.html#a19364866
I created a Singleton For Standard Analyzer too. But the problem still persists. I have 2 singletons now. 1 for Standard Analyzer and other for IndexSearcher. The code is as follows : package watchlistsearch.core; import java.io.IOException; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.store.Directory; import org.apache.lucene.store.RAMDirectory; import watchlistsearch.utils.Constants; public class IndexSearcherFactory { private static IndexSearcherFactory instance = null; private IndexSearcher indexSearcher; private IndexSearcherFactory() { } public static IndexSearcherFactory getInstance() { if (IndexSearcherFactory.instance == null) { IndexSearcherFactory.instance = new IndexSearcherFactory(); } return IndexSearcherFactory.instance; } public IndexSearcher getIndexSearcher() throws IOException { if (this.indexSearcher == null) { Directory directory = new RAMDirectory(Constants.INDEX_DIRECTORY); indexSearcher = new IndexSearcher(directory); } return this.indexSearcher; } } package watchlistsearch.core; import java.io.IOException; import org.apache.log4j.Logger; import org.apache.lucene.analysis.standard.StandardAnalyzer; --------------------------------------------------------------- public class AnalyzerFactory { private static AnalyzerFactory instance = null; private StandardAnalyzer standardAnalyzer; Logger logger = Logger.getLogger(AnalyzerFactory.class); private AnalyzerFactory() { } public static AnalyzerFactory getInstance() { if (AnalyzerFactory.instance == null) { AnalyzerFactory.instance = new AnalyzerFactory(); } return AnalyzerFactory.instance; } public StandardAnalyzer getStandardAnalyzer() throws IOException { if (this.standardAnalyzer == null) { this.standardAnalyzer = new StandardAnalyzer(); logger.debug("StandardAnalyzer Initialized.."); } return this.standardAnalyzer; } } -- View this message in context: http://www.nabble.com/Memory-Leak--tp22663917p22666121.html Sent from the Lucene - Java Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org