refactor: remove TH1::AddDirectory from DQMGenericClient#49575
refactor: remove TH1::AddDirectory from DQMGenericClient#49575cmsbuild merged 4 commits intocms-sw:masterfrom
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.
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.
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.
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.
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