Problem 75

Summary: Memory leak in the hadronic processes
Product: Geant4 Reporter: dellacqu
Component: processes/hadronicAssignee: Hans-Peter.Wellisch
Status: CLOSED REMIND    
Severity: major CC: John.Allison, Makoto.Asai
Priority: P2    
Version: 1.0   
Hardware: PC   
OS: Linux   

Description dellacqu 2000-03-28 03:09:51 CEST
There seems to be a major memory leak in the hadronic physics stuff which
causes any program running with the ExN04 physics list to eventually stop
after a few events, when run at sufficiently high energy. Hans-Peter had
a look, confirmed there is a leak but he can't find a way of debugging the
program: please contact him for details...
Comment 1 Hans-Peter.Wellisch 2000-03-28 08:17:59 CEST
Hi Gabriele, I tried to run this in workshop, with the result that the leak
comes from vector_new. Unfortunately, with vector being a templete, here I am
stuck. Can you please have a look with insure?
The code is in ~hpw/public/ForGabriele.tar.gz
Comment 2 Gabriele Cosmo 2000-04-04 12:27:59 CEST
Problem analyzed on reference-tag geant4-01-00-ref-08 using SUN Workshop.
A complete summary of the leakage can be found in my public AFS area, under
~gcosmo/public/bug75/leak.log.
A consistent leakage seems originated in G4ReactionDynamics when functions
AddBlackTrackParticle, TwoCluster and GenerateXandPt are invoked
(production of secondaries? Who owns the secondaries produced?).
G4ReactionProduct objects are dynamically instantiated and apparently
never deleted. A chain of allocations of vectors is then triggered
(verification of a possible correlation with the leaks above is to be
verified).
A leakage is also observed in G4HadronicInelasticProcess at initialisation
of theCrossSectionDataStore, concerning the dynamic allocation of
G4HadronInelasticDataSet.
Comment 3 Hans-Peter.Wellisch 2000-04-10 13:41:59 CEST
Seems I identified the problem. The usage of G4FastVector is not consistant with
its memory management policy, consistently throughout the LE code. I changed the
main usage, and the problem is diminished. There still seems to be something
smaller left, but I am down to ~1MB/2000GeV.
Continue to investigate....
Comment 4 Hans-Peter.Wellisch 2000-04-11 02:02:59 CEST
Down to 1MB/10000GeV...
Comment 5 Hans-Peter.Wellisch 2000-04-15 07:42:59 CEST
I have run 100TeV (1.5 days of running on my solaris box) of hadronic flux
without significant growth in memory usage. There is still something small, but
this should be usable as is. I'll tag, and start the release cycle.