TMVA::Reader destructor issue

Dear members of the root support,

In the code we develop, we have to call many times TMVA::Reader. It’s appear that a huge memory leak happend due to an undeleted map (fMethodMap) in the destructor (TMVA::~Reader). This memory leak causing my OS (Ubuntu 12.04) to freeze I had to track the leak and finally I propose this solution :
in file $ROOTSYS/tmva/src/Reader.cxx

[code]TMVA::Reader::~Reader( void )
{
// destructor

delete fDataSetManager; // DSMTEST

delete fLogger;

std::map<TString, IMethod* >::iterator it_del;
for( it_del = fMethodMap.begin(); it_del != fMethodMap.end(); it_del++)
{
delete (*it_del).second;
(*it_del).second = 0;
}
fMethodMap.clear();
}[/code]

Will you envisage to correct this bug in a futur release ?
Thank you for your consideration
Best regards
PS : my root environment :
“TMVA Release” value=“4.1.4
"ROOT Release” value="5.34/10

Hi Baptiste,

thanks a lot for your report and proposed fix. I could as well see some memory leaks.
I filed a report in our ticketing system for the TMVA author to study and potentially fix:
sft.its.cern.ch/jira/browse/ROOT-6551

Cheers,
Danilo

Dear Danilo,

I saw that the patch I propose is now in the version 5.34/23 and above.
Would you mind to set the status of this post to solved ?

Thank you
Cheers

Baptiste

Done.