Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-6258

Memory leaks in SVM algorithm in TMVA

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • High
    • Resolution: Fixed
    • 5.34/00
    • 6.08/08
    • TMVA
    • None
    • (don't know what to put here)

    Description

      While using SVM, I noticed large memory consumption making SVM unusable for me (large = quickly more than 16 GB).

      Using heap profiling tools, I found at least 3 important issues.

      Bug A:
      tmva/src/TransformationHandler.cxx
      in method TMVA::TransformationHandler::CalcTransformation

      There is a loop and a special treatment of the first loop iteration. The first loop iteration leaks memory. See attached patch.

      Bug B: the GetLine() function leaks. File: SVWorkingSet.cxx.
      Code is:
      Float_t *pt;
      for( UInt_t i = 0; i < fInputData->size(); i++)

      { pt = fKMatrix->GetLine(i); fInputData->at(i)->SetLine(pt); fInputData->at(i)->SetNs(i); if(fdoRegression) fInputData->at(i)->SetErrorCache(fInputData->at(i)->GetTarget()); }

      Problem: GetLine returns a "new Float_t[]" (also, why is the scope of pt larger than it could be?)

      When is it deleted? In the destructor? Shouldn't it be delete[] instead of delete in SVEvent's destructor?

      This is probably connected to:
      file MethodSVM.cxx, in void TMVA::MethodSVM::Train(). In the beginning "new SVEvent"s are created. At the end of the method, you'll notice the following line:
      // for (UInt_t i=0; i<fInputData->size();i++) delete fInputData->at;
      Looking at this method alone, it looks like commenting in this line should fix the leak, it however results in a segfault. I didn't have a closer look yet.

      For more information, I have attached a pdf (created using google's performance tools, heap checker = normal - this is AFTER applying the patch)

      Attachments

        Activity

          People

            kialbert Kim Albertsson (Inactive)
            5ec16ad4cd4ea320131c Wolf Behrenhoff
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Actual End: