Repository navigation
fix memory leaks and thread issues in BCFitter and descendants - #98
Conversation
The major goal was to remove all apparent memory leaks. Along the way, I found many other things to improve BCFitter and children --------------------- * require a TF1 in the constructor and copy it. This way, dozens of checks if TF1 exists are obsolete and the code is much shorter. No more setting the TF1 later on. * no more pointer members => copy ctor, copy assignment, swap etc. are trivial and autogenerated. The copy now works as expected and all members are cleared up to avoid memory leaks * use BCTrash<TObject> to keep root plot objects alive until the BCFitter goes out of scope, then they are properly removed * use `virtual` keyword where overriding is intended * remove `CDF` and related code. I put this in years ago and it seems nobody ever used this, except we did for a comparison in our paper to see that Kolmogorov's test is not as useful as the others. * remove `ReadErrorBandFromFile`. Seemed to be very specific to an ancient use. * rename some variables `hist1` -> `trials`, `hist2` -> `successes`... for readability * add `Integral` as a common method to `BCFitter` Examples -------- * minor updates to follow the new ctor * replace pointers by values where possible to move away from root-style C++. Remaining pointers put into the trash
|
Tests run fine on OS-X but on Linux, tests fail reproducibly at "graphFitterAdvancedExample.C" when using ROOT-5.34.32. With ROOT-6, all seems fine. |
* adapt to new BCGraphFitter API * fix out-of-source build * remove pointers
|
I fixed |
|
Now distcheck fails completely ;-) Something missing in dist? |
* `virtual` when overriding desired * ctor initializer list
Fix memory leaks and thread issues in BCFitter and descendants
There was a problem hiding this comment.
BCTrash might not be an optimal name for this class:
BCTrash.Put(...)
sounds like "delete this", instead of "keep this alive". :-)
There was a problem hiding this comment.
BCTrash might not be an optimal name for this class:
BCTrash.Put(...)
sounds like "delete this", instead of "keep this alive". :-)
In fact Dan and I tossed a lot of different names up, this one remained. Think about this way: if you want a file removed without getting it back you do rm file. If you put it into the trash, you know it's still there until somebody empties the trash later. This corresponds pretty well to our use case at hand.
If, however, you can suggest a better name, I'm happy to change it again.
There was a problem hiding this comment.
I don't have a really good name for it, either. Well, it's an internal class, so we can change it later, if we want to.
I managed to make the code much safer and removed a total of 500 lines.
The first commit is just convenience to avoid memory leaks. Check the message of the second commit for an overview of changes.
make checkpassed with multiple threads on root 5.34.25, 6.04.10 and 6.05.02