Hello,

I think there is a leak in the file QueryTermExtractor.cpp, function  
QueryTermExtractor::getTerms
It was submitted already 07/2008 but I do not see it in the current version of 
CLucene or Lucene++

void QueryTermExtractor::getTerms(const Query * query, WeightedTermList * 
terms, bool prohibited, const TCHAR* fieldName)
{
   if (query->instanceOf( BooleanQuery::getClassName() ))
   {
      getTermsFromBooleanQuery((BooleanQuery *) query, terms, prohibited, 
fieldName);
   }
// FilteredQuery not implemented yet
//            else if (query->instanceOf( FilteredQuery::getClassName() ))
//                   getTermsFromFilteredQuery((FilteredQuery *) query, terms);
   else
   {
      TermSet nonWeightedTerms;
      query->extractTerms(&nonWeightedTerms);
      for (TermSet::iterator iter = nonWeightedTerms.begin(); iter != 
nonWeightedTerms.end(); iter++)
      {
          Term * term = (Term *)(*iter);
          if ( fieldName == NULL || term->field() == fieldName )
          {
             WeightedTerm* pWeigthedTerm = _CLNEW 
WeightedTerm(query->getBoost(), term->text());
            // from SourceForce 2008/07
             //if (terms->find(pWeigthedTerm)==terms->end()) // possible memory 
leak if key already present
             //   terms->insert(pWeigthedTerm);
             //else
             //   _CLDELETE(pWeigthedTerm);
             // 29.04.2014: optimistic insert, assume most of the case element 
is not in so prevent searching first
             if (!terms->insert(pWeigthedTerm).second) //
                _CLDELETE(pWeigthedTerm);
          }
          _CLLDECDELETE( term );
      }
   }
}

Regards
Roger Bosshard

Roger Bosshard * Head of Development * MarketMap Realtime * SunGard * Route 
François-Peyrot 12 * 1218 Le Grand Saconnex, Geneva, Switzerland
Tel +41 22 715 44 52 * Fax +41 22 715 44 11 * 
www.sungard.com/marketmap<http://www.sungard.com/marketmap>

[Description: Description: Description: Description: 
coc-signature-03-2012]<http://www.capitalize-on-change.com/?email=70150000000Y1Et>
Join the online conversation with SunGard's customers, partners and industry 
experts and find an event near you at: 
www.sungard.com/ten<http://www.capitalize-on-change.com/?email=70150000000Y1Et>.

CONFIDENTIALITY: This e-mail (including any attachments) may contain 
confidential, proprietary and privileged information, and unauthorized 
disclosure or use is prohibited.  If you receive this e-mail in error, please 
notify the sender and delete this e-mail from your system.




------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
CLucene-developers mailing list
CLucene-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/clucene-developers

Reply via email to