Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 99305 invoked from network); 23 Mar 2007 05:54:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 Mar 2007 05:54:27 -0000 Received: (qmail 59052 invoked by uid 500); 23 Mar 2007 05:54:32 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 58724 invoked by uid 500); 23 Mar 2007 05:54:30 -0000 Mailing-List: contact java-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-dev@lucene.apache.org Received: (qmail 58713 invoked by uid 99); 23 Mar 2007 05:54:30 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Mar 2007 22:54:30 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 3B42871403E for ; Thu, 22 Mar 2007 22:53:32 -0700 (PDT) Message-ID: <27458847.1174629212210.JavaMail.jira@brutus> Date: Thu, 22 Mar 2007 22:53:32 -0700 (PDT) From: "Doron Cohen (JIRA)" To: java-dev@lucene.apache.org Subject: [jira] Commented: (LUCENE-842) ParallelMultiSearcher memory leak In-Reply-To: <10983120.1174554932138.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/LUCENE-842?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12483418 ] Doron Cohen commented on LUCENE-842: ------------------------------------ Thomas, thanks for following up closely on this (and great that this is not a real bug :-) ) Doron > 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 > Fix For: 2.1 > > Attachments: search_test_gc.PNG, search_test_heap.PNG, TestParallelMultiSearcherMemLeak.java > > > 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); // causes LEAK BAD > //multiSearcher = new MultiSearcher(indexSearchers); // NO leak GOOD > 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: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org