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
fixing memory leak in L1 CSCTrackFinder #9889
Conversation
A new Pull Request was created by @davidlange6 (David Lange) for CMSSW_7_4_X. fixing memory leak in L1 CSCTrackFinder It involves the following packages: L1Trigger/CSCTrackFinder @cmsbuild, @mulhearn can you please review it and eventually sign? Thanks. |
lut_read_in = true; | ||
|
||
if ( !lut_read_in) { | ||
pt_lut = new ptdat[1<<21]; |
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 isn't thread safe since it is a global that changes. Shouldn't this just be a member data of this class or put in the EventSetup?
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.
Also better to use std::unique_ptr< T[]>
to manage the memory.
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.
even better is to remove the copy altogether and use the conditions object…but less trivial
On Jun 25, 2015, at 3:22 PM, Chris Jones notifications@github.com wrote:
In L1Trigger/CSCTrackFinder/src/CSCTFPtLUT.cc:
@@ -86,16 +86,17 @@ CSCTFPtLUT::CSCTFPtLUT(const edm::EventSetup& es)
//std::cout << "pt_method from 4 " << std::endl;
lowQualityFlag = 4;
isBeamStartConf = true;- pt_lut = new ptdat[1<<21];
- edm::ESHandle ptLUT;
- es.get().get(ptLUT);
- const L1MuCSCPtLut *myConfigPt_ = ptLUT.product();
- memcpy((void_)pt_lut,(void_)myConfigPt_->lut(),(1<<21)*sizeof(ptdat));
- lut_read_in = true;
- if ( !lut_read_in) {
pt_lut = new ptdat[1<<21];
Also better to use std::unique_ptr< T[]> to manage the memory.
—
Reply to this email directly or view it on GitHub.
@cmsbuild, please test |
The tests are being triggered in jenkins. |
fixing memory leak in L1 CSCTrackFinder
50MB saved..