Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Invalid
-
2.1
-
None
-
Windows XP SP2 and Red Hat EL 4
-
New
Description
When using the org.apache.lucene.search.ParallelMultiSearcher to search on a single searcher (reading a single index), continuous runs result in a memory leak.
Substituting the MultiSearcher does not result in a memory leak. and is the workaround currently used.
And example of the code used is as follows. Note the close routine was added for the individual searchers and the MultiSearcher otherwise the was a leak in MultiSearcher.
private void doSearch(Search search)
{
IndexSearcher[] indexSearchers = null;
MultiSearcher multiSearcher = null;
try
finally
{ close(indexSearchers); close(multiSearcher); }}
/**
- Close the index searchers.
- @param indexSearchers Index Searchers.
*/
private static void close(IndexSearcher[] indexSearchers)
{
if (indexSearchers != null)
{
for (IndexSearcher indexSearcher : indexSearchers)Unknown macro: { try { indexSearcher.close(); } catch (IOException ioex) { LOGGER.warn("Unable to close the index searcher!", ioex); } }}
}
/**
- Close the multi-searcher.
- @param aMultiSearcher Index Searchers.
*/
private static void close(MultiSearcher aMultiSearcher)Unknown macro: { try { aMultiSearcher.close(); } catch (IOException ioex) { LOGGER.warn("Unable to close the multi searcher!", ioex); } }