Opened 12 years ago
Closed 12 years ago
#47 closed Bug (fixed)
Memory leaks limit number of HepMC events that can be processed
Reported by: | Sourav Mandal | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | Delphes code | Version: | all recent versions (> 1.8) |
Keywords: | Cc: |
Description
Due to serious memory leaks in HepMCConverter, one can only process a limited number of events in an HepMC file. For example, on my machine w/ 4GB of RAM I can only read in 140K LHC @ TeV top-pair events (generated by Herwig++) before Delphes exits.
I am attaching a patch which corrects these memory leaks. Now, I can process an arbitrary number of events without ever consuming more than 200MB of RAM.
The patch contains the following fixes:
1) Clear index_to_particle vector and particle_to_index map when reading in a new event.
2) Add virtual keywords to PdgParticle and PdgTable destructors. This is necessary for the clear method to work.
Attachments (1)
Change History (5)
by , 12 years ago
Attachment: | delphes-memleak.patch added |
---|
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Thanks for this too, merging...
Out of curiosity, why do we need virtual destructors ?
comment:3 by , 12 years ago
Indeed you're right, for simply clearing index_to_particle and particle_to_index the virtual keyword should not required, as they hold instances of PdgParticle itself, not instances of subclasses. Same with the container holding PdgTable.
If nowhere in Delphes are PdgParticle and PdgTable subclassed, it's safe to leave out the virtual keyword.
However, generically, virtual destructors are necessary to avoid undefined behavior.
comment:4 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Sorry, the second sentence should read: For example, on my machine w/ 4GB of RAM I can only read in 140K top-pair events (7 TeV LHC, generated by Herwig++) before Delphes quits.