No, I have a singleton from where I get my searcher and it is kept through
out the application.



Michael McCandless-2 wrote:
> 
> 
> Are you not closing the IndexSearcher?
> 
> Mike
> 
> Chetan Shah wrote:
> 
>>
>> I am initiating a simple search and after profiling the my  
>> application using
>> NetBeans. I see a constant heap consumption and eventually a server  
>> (tomcat)
>> crash due to "out of memory" error. The thread count also keeps on
>> increasing and most of the threads in "wait" state.
>>
>> Please let me know what am I doing wrong here so that I can avoid  
>> server
>> crash. I am using Lucene 2.4.0.
>>
>>
>>                      IndexSearcher indexSearcher =
>> IndexSearcherFactory.getInstance().getIndexSearcher();                       
>>                                                         
>>                      
>>                      //Create the query and search
>>                      QueryParser queryParser = new QueryParser("contents", 
>> new
>> StandardAnalyzer());
>>                      Query query = queryParser.parse(searchCriteria);
>>                      
>>                      
>>                      TermsFilter categoryFilter = null;
>>                      
>>                      // Create the filter if it is needed.
>>                      if (filter != null) {           
>>                              Term aTerm = new 
>> Term(Constants.WATCH_LIST_TYPE_TERM);
>>                              categoryFilter = new TermsFilter();
>>                              for (int i = 0; i < filter.length; i++) {       
>>                         
>>                                      aTerm = aTerm.createTerm(filter[i]);
>>                                      categoryFilter.addTerm(aTerm);
>>                              }
>>                      }
>>                      
>>                      // Create sort criteria
>>                      SortField [] sortFields = new SortField[2];
>>                      SortField watchList = new 
>> SortField(Constants.WATCH_LIST_TYPE_TERM,
>> SortField.STRING);
>>                      SortField score = SortField.FIELD_SCORE;
>>                      if (sortByWatchList) {
>>                              sortFields[0] = watchList;
>>                              sortFields[1] = score;
>>                      } else {
>>                              sortFields[1] = watchList;
>>                              sortFields[0] = score;                          
>>                              
>>                      }
>>                      Sort sort = new Sort(sortFields);
>>                      
>>                      // Collect results
>>                      TopDocs topDocs = indexSearcher.search(query, 
>> categoryFilter,
>> Constants.MAX_HITS, sort);
>>                      ScoreDoc scoreDoc[] = topDocs.scoreDocs;
>>                      int numDocs = scoreDoc.length;
>>                      if (numDocs > 0) results = scoreDoc;    
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/Memory-Leak--tp22663917p22663917.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
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Memory-Leak--tp22663917p22666060.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

Reply via email to