[
https://issues.apache.org/jira/browse/LUCENE-842?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12483264
]
Doron Cohen commented on LUCENE-842:
------------------------------------
It is not clear to me how this code demonstrates a mem leak. The program itself
is not very useful for showing/fixing that because it is not runnable as is -
lots of getXXYZ() methods with unknown logic - others cannot compile and run it.
What I get from the problem description and code is this:
<quote>
If someone repeats the following sequence of steps over and over again:
{
[1] open one index searcher S over an index;
[2] create a parallel multi searcher P over S;
[3] search using P;
[4] close P;
[5] close S;
}
then eventually a memory leak will be evident.
</quote>
And it seems you think that a single searcher is the case that causes the leak.
Do you mean that with (say) two searchers there want be a leak?
> ParallelMultiSearcher memory leak
> ---------------------------------
>
> Key: LUCENE-842
> URL: https://issues.apache.org/jira/browse/LUCENE-842
> Project: Lucene - Java
> Issue Type: Bug
> Components: Search
> Affects Versions: 2.1
> Environment: Windows XP SP2 and Red Hat EL 4
> Reporter: Thomas Connolly
> Priority: Critical
>
> 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
> {
> indexSearchers = getIndexSearcher();
>
> // aggregate the searches across multiple indexes
> //multiSearcher = new ParallelMultiSearcher(indexSearchers);
> multiSearcher = new MultiSearcher(indexSearchers);
> final QueryParser parser = new QueryParser("content", new
> ExtendedStandardAnalyser());
> final Query query = parser.parse(search.getQuery());
>
> final Hits hits = multiSearcher.search(query,
> getFilter(search.getFilters()), getSort(search.getSort()));
> // process hits...
> }
> 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)
> {
> 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)
> {
> try
> {
> aMultiSearcher.close();
> }
> catch (IOException ioex)
> {
> LOGGER.warn("Unable to close the multi searcher!", ioex);
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]