Hi all, recently I continued to work on the smart_pointers branch and discovered a memory leak in BooleanScorer2.cpp, lines 610--624:
[...] if ( _internal->allowDocsOutOfOrder && _internal->requiredScorers.size() == 0 && _internal->prohibitedScorers.size() < 32 ) { BooleanScorer* bs = _CLNEW BooleanScorer( getSimilarity(), _internal->minNrShouldMatch ); Internal::ScorersType::iterator si = _internal->optionalScorers.begin(); while ( si != _internal->optionalScorers.end() ) { bs->add( (*si), false /* required */, false /* prohibited */ ); si++; } si = _internal->prohibitedScorers.begin(); while ( si != _internal->prohibitedScorers.end() ) { bs->add( (*si), false /* required */, true /* prohibited */ ); si++; } bs->score( hc ); } else { [...] Here bs is created, but never deleted. But if I add a delete after the score() the tests testBooleanScorer2WithProhibitedScorer fails, because bs takes the ownership of the optional and prohibited scorers, i.e., deleting bs deletes also these scorers. This also means that these scorers can't be reused. My first idea was, to remove the corresponding deletes in BooleanScorer/SubScorer. But then I get errors on other places in BooleanScorers due to double deletes, etc. It seems to me that only BooleanScorer should have the ownership of this subscorers. Any ideas, comments on this? Kind regards, Veit ------------------------------------------------------------------------------ Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d _______________________________________________ CLucene-developers mailing list CLucene-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/clucene-developers