-
Notifications
You must be signed in to change notification settings - Fork 4.6k
refactor: remove TH1::AddDirectory from DQMGenericClient #49575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Retrieve FitSlicesY's results from TObjArray instead of current gDirectory.
|
cms-bot internal usage |
|
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49575/47104 |
|
A new Pull Request was created by @gabrielmscampos for master. It involves the following packages:
@cmsbuild, @ctarricone, @gabrielmscampos, @nothingface0, @rseidita can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
|
please test |
…ctArray goes out of scope
|
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49575/47113 |
|
Pull request #49575 was updated. @cmsbuild, @ctarricone, @gabrielmscampos, @nothingface0, @rseidita can you please check and sign again. |
|
please test |
| TH1* h2; | ||
| TH1* h3; | ||
|
|
||
| TH1* fetchSlice(TObjArray& arr, const std::string& name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to leak memory. Might I suggest
| TH1* fetchSlice(TObjArray& arr, const std::string& name) { | |
| std::unique_ptr<TH1> fetchSlice(TObjArray& arr, const std::string& name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Dr15Jones, yes, I can implement your suggestion. May I ask why the first can lead to memory leak? Since it returns a raw pointer, the caller is responsible for deleting it (that is where I see the memory leak possibility), and in this case that deletion happens in the class destructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had not looked at the scope for the variables being used. As CMS convention is to use m_' prefix or a _ suffix for member data names I assumed these were local variables. So it sounds like it isn't a memory leak. Might I suggest changing those member variables to be std::unique_ptr<> anyway and having the function still return std::unique_ptr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Done. I also took the opportunity to add the _ suffix to the member data names.
|
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49575/47119 |
|
Pull request #49575 was updated. @cmsbuild, @ctarricone, @gabrielmscampos, @nothingface0, @rseidita can you please check and sign again. |
|
please test |
|
+1 Size: This PR adds an extra 28KB to repository DAS Queries: The DAS query tests failed, see the summary page for details. Comparison SummarySummary:
|
|
+dqm |
|
This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @mandrenguyen, @ftenchini, @sextonkennedy (and backports should be raised in the release meeting by the corresponding L2) |
|
+1 |
Retrieve FitSlicesY's results from TObjArray instead of current gDirectory.
PR description:
Resolves DQM's part in #49543 by removing TH1::AddDirectory and refactoring the code to retrieve histograms from a TObjArray.
PR validation:
cmsRun -j JobReport4.xml step4_HARVESTING.py