Skip to content
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

Merged
merged 1 commit into from Jun 26, 2015

Conversation

davidlange6
Copy link
Contributor

50MB saved..

@cmsbuild
Copy link
Contributor

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.
@Martin-Grunewald this is something you requested to watch as well.
You can sign-off by replying to this message having '+1' in the first line of your reply.
You can reject by replying to this message having '-1' in the first line of your reply.
If you are a L2 or a release manager you can ask for tests by saying 'please test' in the first line of a comment.
@Degano you are the release manager for this.
You can merge this pull request by typing 'merge' in the first line of your comment.

lut_read_in = true;

if ( !lut_read_in) {
pt_lut = new ptdat[1<<21];
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@davidlange6
Copy link
Contributor Author

@cmsbuild, please test

@cmsbuild
Copy link
Contributor

The tests are being triggered in jenkins.

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants