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

Fix mem leak in rivet analyzer #15673

Merged
merged 2 commits into from Sep 1, 2016
Merged

Conversation

thuer
Copy link
Contributor

@thuer thuer commented Aug 31, 2016

There was a minor oversight in the last fix to the rivet analyzer that missed to delete the new HepMC::GenEvent in certain cases

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @thuer (Sebastian Thüer) for CMSSW_8_1_X.

It involves the following packages:

GeneratorInterface/RivetInterface

@covarell, @perrozzi, @thuer, @cmsbuild, @davidlange6, @govoni can you please review it and eventually sign? Thanks.
@agrohsje, @mkirsano this is something you requested to watch as well.
@slava77, @smuzaffar you are the release manager for this.

cms-bot commands are list here #13028

@perrozzi
Copy link
Contributor

please test

@@ -133,7 +133,7 @@ void RivetAnalyzer::analyze(const edm::Event& iEvent,const edm::EventSetup& iSet
_analysisHandler.analyze(*myGenEvent);

//if we have cloned the GenEvent, we delete it
if ( _useExternalWeight )
if ( _useExternalWeight || _xsection > 0 )
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be better to add at line 92

std::unique_ptr<HepMC::GenEvent> tmpGenEvtPtr;

Then replace line 94 with

tmpGenEvtPtr = std::make_unique<HepMC::Event>(*(evt->GetEvent()));

Then line 121 becomes

myGenEvent = tmpGenEvtPtr.get();

Finally you then can get rid of lines 136 and 137.

This change also avoids a memory leak if the code throws at line 104.

@thuer
Copy link
Contributor Author

thuer commented Aug 31, 2016

thanks @Dr15Jones , I updated the pull request

@cmsbuild
Copy link
Contributor

Pull request #15673 was updated. @covarell, @perrozzi, @thuer, @cmsbuild, @davidlange6, @govoni can you please check and sign again.

@perrozzi
Copy link
Contributor

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Aug 31, 2016

The tests are being triggered in jenkins.
https://cmssdt.cern.ch/jenkins/job/ib-any-integration/14859/console

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

@perrozzi
Copy link
Contributor

+1

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next CMSSW_8_1_X IBs (tests are also fine). This pull request requires discussion in the ORP meeting before it's merged. @slava77, @davidlange6, @smuzaffar

@cmsbuild
Copy link
Contributor

@davidlange6
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit a0528ec into cms-sw:CMSSW_8_1_X Sep 1, 2016
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

5 participants