Message: Potential memory leak in G4RadioactiveDecay and G4VUserPhysicsList Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Potential memory leak in G4RadioactiveDecay and G4VUserPhysicsList 

Forum: Physics List
Date: 27 Aug, 2012
From: Clare Huang <Clare Huang>

Hi all,

I have been running my geant4 application with valgrind to detect any potential memory leak since my simulation tends to get stuck and did not complete when running the simulation of 1M - 10M events. I am using geant4.9.4.p02 version for my simulation. I've narrowed my memory leak bug to physicslist and some tracking related classes. I registered G4EmStandardPhysics, G4DecayPhysics, and G4RadioactivedecayPhysics in the physics list using G4VModularPhysicsList class methods. See attachment for the code that i drafted to define the physics list in my application. I've ran the application with 10M events once, and it completed the run successfully. However, I haven't run multiple simulation sequentially to see if the application would stop without completing the simulation. Also, valgrind indicated some source of memory leak, and I was wondering if any of you can shed some light in understanding the memory leak.

- G4RadioactiveDecay::G4RadioactiveDecay(G4String cont&) ==> the memory of a new statement was not deleted in the destructor. I believe the memory allocated for theIsotopeTable = new G4RIsotopeTable() was not deleted in the class destructor. In ~G4RadioactiveDecay()function, I noticed that the line 'delete theIsotopeTable' was commented out (not implemented for geant4.9.4.p02). is there a reason that this statement is commented out? I believe it might be a source of memory leak in this class.

- memory allocated by new statements in G4RadioactiveDecay::LoadDecayTable(G4ParticleDefinition&) was not deallocated.

- memory allocated by new statements in G4VUserPhysicsList::AddTransportation() invoked in G4VModularPhysicsList::ConstructProcess() etc. was not deallocated.

Can someone let me know if there's a bug report regarding this memory leak for geant4.9.4.p02? Are these memory leak bugs likely to cause a huge memory leak that ultimately halt the simulation run? let me know when you have a chance.

Thanks a lot in advance for your time and help.

-Clare

VHDPhysicsList.cc ========================================================================

#include "VHDPhysicsList.hh"
#include "globals.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleWithCuts.hh"
#include "G4ProcessManager.hh"
#include "G4ProcessVector.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"

#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4ios.hh"
#include <iomanip>

#include "G4RadioactiveDecayPhysics.hh"
#include "G4DecayPhysics.hh"
#include "G4EmStandardPhysics.hh"

VHDPhysicsList::VHDPhysicsList():  G4VModularPhysicsList()
{
  // default cut value  (1.0mm)
  defaultCutValue = 1.0*mm;

  RegisterPhysics(new G4EmStandardPhysics());
  RegisterPhysics(new G4DecayPhysics());
  RegisterPhysics(new G4RadioactiveDecayPhysics());
  SetVerboseLevel(0);
}

VHDPhysicsList::~VHDPhysicsList() { }

void VHDPhysicsList::SetCuts()
{
  //  " G4VUserPhysicsList::SetCutsWithDefault" method sets
  //   the default cut value for all particle types
  SetCutsWithDefault();
}
==========================================================================

VHDPhysicsList.hh ===========================================================================

#ifndef VHDPhysicsList_h
#define VHDPhysicsList_h 1

#include "G4VModularPhysicsList.hh"
#include "globals.hh"

class G4VPhysicsConstructor;

class VHDPhysicsList: public G4VModularPhysicsList
{
public:
  VHDPhysicsList();
  virtual ~VHDPhysicsList();

public:
  // SetCuts()
  virtual void SetCuts();

}; #endif ============================================================================

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Idea: Re: Potential memory leak in G4RadioactiveDecay and G4VUserPhysicsList   (Andrea Dotti - 03 Sep, 2012)
 Add Message Add Message
to: "Potential memory leak in G4RadioactiveDecay and G4VUserPhysicsList"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]