Should I delete roofit result object?


if I wish to manage in a “clean” way without any memory leak,

Do I need to delete the roofitresult object after a fit ?

RooFitResult *roofitresult;


//I no more need roofitresult

As a fact, the allocation of roofitresult object has been made by “fitTo”

–>should I manage to delete roofitresult when I no more need it ?

it seems that all roofit programs that I saw from colleagues so far, forget to delete this object ? would that drive to a (small) memory leak ?

Thank you

@StephanH Can you advise?

Hello @escalier,

good point …
I had hoped that this would be clarified in the documentation, but indeed, it wasn’t mentioned:

In general, the user has to delete the fit result. Failing to do so, there will be a small memory leak. If one ran a fit many times in a loop, it might become noticeable.

Thank you for the explanations.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.