Created attachment 425 [details] A Brief Excerpt of Valgrind Output While debugging my application which uses Geant4 for the simulation of gamma ray interactions with mater using the standard QBBC physics list, Valgrind detected a memory leak shown in the included excerpt. Note that this output is repeated many times over apparently for each interaction. Line 49 of G4VScatteringCollision.cc (processes/hadronic/models/im_r_matrix/src/G4VScatteringCollision.cc), where theAngularDistribution is initialized is reported as a memory leak because on line 183 of the same file, in G4VScatteringCollision::establish_G4MT_TLS_G4VScatteringCollision(), the variable theAngularDistribution is overwritten with a new G4AngularDistribution without destroying the original. Something similar to the following fixes the memory leak 180 void G4VScatteringCollision::establish_G4MT_TLS_G4VScatteringCollision() 181 { 182 establish_G4MT_TLS_G4VCollision(); 183 if (theAngularDistribution) 184 { 185 delete(theAngularDistribution); 186 } 187 theAngularDistribution = new G4AngularDistribution(true); 189 } Two additional comments on the fix. I am not familiar with the contents and behavior of the G4AngularDistribution class, so this fix preserves the original behavior of replacing theAngularDistribution. Second, the check to see if theAngularDistribution is not a null pointer before deletion is likely unnecessary. I do not see a way for the program to get to this step without theAngularDistribution being initialized.
Will look at this.
Fixed in Geant4 10.4