Skip to content

[Math] Fix memory leak when using GSLMultiFit and improve Fitter class#10439

Merged
lmoneta merged 3 commits intoroot-project:masterfrom
lmoneta:fix_fitter_gslmultimin
Apr 28, 2022
Merged

[Math] Fix memory leak when using GSLMultiFit and improve Fitter class#10439
lmoneta merged 3 commits intoroot-project:masterfrom
lmoneta:fix_fitter_gslmultimin

Conversation

@lmoneta
Copy link
Copy Markdown
Member

@lmoneta lmoneta commented Apr 22, 2022

This Pull request fixes a memory leak reported in https://root-forum.cern.ch/t/gslmultifit-memory-leak-with-root-fitter/49566 when using GSLMultiFit.

In addition for fixing for the leak the handling of the internal transformation function is improved and an extra un-needed clone of the objective function in the Fitter class is avoided.

lmoneta added 2 commits April 22, 2022 15:34
Refactor some of the fitting code avoiding a Clone of the chi2 or likelihood function. Make better used of the shared pointer to the objective function
@lmoneta lmoneta requested a review from guitargeek April 22, 2022 13:39
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, ROOT-ubuntu2004/soversion, mac1015/python3, mac11/cxx17, windows10/cxx14
How to customize builds

FitTransformFunction(const FitMethodFunction & f, MinimTransformFunction *transFunc ) :
FitMethodFunction( f.NDim(), f.NPoints() ),
fOwnTransformation(false),
fOwnTransformation(true),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR look good to me, thanks for the improvements in the ownership model!

Now that you use smart pointers, can this fOwnTransformation member be removed?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the comment. I have now improved also that internal class and the data member is removed!

Copy link
Copy Markdown
Contributor

@guitargeek guitargeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, I only have one request about the fOwnTransformation member.

Include comment of Jonas, and use now unique_ptr for managing the TransformFunction pointer. Remove also a constructor which was not used and was actually leaking memory.
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, ROOT-ubuntu2004/soversion, mac1015/python3, mac11/cxx17, windows10/cxx14
How to customize builds

Copy link
Copy Markdown
Contributor

@guitargeek guitargeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the update, looks very good now!

@lmoneta lmoneta merged commit e3efa30 into root-project:master Apr 28, 2022
@phsft-bot
Copy link
Copy Markdown

Build failed on mac1015/python3.
Running on macitois21.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2022-04-29T05:19:48.608Z] FAILED: builtins/openssl/OPENSSL-prefix/src/OPENSSL-stamp/OPENSSL-download /Volumes/HD2/build/workspace/root-pullrequests-build/build/builtins/openssl/OPENSSL-prefix/src/OPENSSL-stamp/OPENSSL-download
  • [2022-04-29T05:19:48.608Z] CMake Error at OPENSSL-stamp/OPENSSL-download-Release.cmake:49 (message):

@lmoneta lmoneta deleted the fix_fitter_gslmultimin branch May 2, 2022 08:29
lmoneta added a commit to lmoneta/root that referenced this pull request Jan 26, 2024
A bug was introduced in root-project#10439 affecting the weighted likelihood fits
lmoneta added a commit to lmoneta/root that referenced this pull request Jan 26, 2024
A bug was introduced in root-project#10439 affecting the weighted likelihood fits

Add missing test for Weighted likelihood fits in stressHistoFit
lmoneta added a commit that referenced this pull request Jan 30, 2024
A bug was introduced in #10439 affecting the weighted likelihood fits

Add missing test for Weighted likelihood fits in stressHistoFit
lmoneta added a commit to lmoneta/root that referenced this pull request Jan 30, 2024
A bug was introduced in root-project#10439 affecting the weighted likelihood fits

Add missing test for Weighted likelihood fits in stressHistoFit
lmoneta added a commit to lmoneta/root that referenced this pull request Jan 30, 2024
A bug was introduced in root-project#10439 affecting the weighted likelihood fits

Add missing test for Weighted likelihood fits in stressHistoFit
lmoneta added a commit that referenced this pull request Feb 1, 2024
A bug was introduced in #10439 affecting the weighted likelihood fits

Add missing test for Weighted likelihood fits in stressHistoFit
lmoneta added a commit that referenced this pull request Feb 1, 2024
A bug was introduced in #10439 affecting the weighted likelihood fits

Add missing test for Weighted likelihood fits in stressHistoFit
ferdymercury pushed a commit to ferdymercury/root that referenced this pull request Apr 10, 2025
A bug was introduced in root-project#10439 affecting the weighted likelihood fits

Add missing test for Weighted likelihood fits in stressHistoFit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants