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

Severe memory leak reading RooFitResult and HypoTestInverterResult from disk



    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 6.04/14
    • Fix Version/s: 6.22/00, 6.20/06
    • Component/s: RooFit/RooStats
    • Labels:
    • Environment:

      Bug confirmed on SLC6 and OS X


      RooFit/RooStats leaks memory when reading out RooFitResult and HypoTestInverterResults from disk.

      The leaks notably already occur when doing something simple like opening a file, retrieving a RooFitResult or HypoTestInverterResult, deleting that, and then closing the file. This caused writing the CLs values of some SUSY optimisation results (30 models, ~8000 SRs) to JSON files to use 50GB not even half-way through.

      The easiest way to test it is to create a file with 1 result in it and then running a simply script like below in Valgrind, or just monitoring the memory usage in top:

      for i in range(0, 1000000):
              # open file
              # read hypotest from file
              # del hypotest
              # close file 

      We have attached a patch that addresses this issue.

      The RooFitResult class forgot to all a static function to RooAbsArg (RooWorkspace's streamer did this correctly). The patch for HypoTestInverterResult ensures it owns its internal HypoTestResults and SamplingDistributions. If it doesn't, the two TLists leak memory. Also, some getters were improved.

      It would be nice to change HypoTestInverterResult internally to return shared_ptrs or const HypoTestResult& from these getters (and not HypoTestResult*) as these are much less prone to accidentally exposing too much of the class, but this might break other things so we didn't do that.

      Geert-Jan Besjes & Ingrid Deigaard


          Issue Links



              • Assignee:
                shageboe Stephan Hageboeck
                gbesjes Geert Jan Besjes (Inactive)
              • Votes:
                0 Vote for this issue
                3 Start watching this issue


                • Created: