Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4AllocatorList Class Reference

#include <G4AllocatorList.hh>

Public Member Functions

 ~G4AllocatorList ()
 
void Register (G4AllocatorBase *)
 
void Destroy (G4int nStat=0, G4int verboseLevel=0)
 
G4int Size () const
 

Static Public Member Functions

static G4AllocatorListGetAllocatorList ()
 
static G4AllocatorListGetAllocatorListIfExist ()
 

Detailed Description

Definition at line 43 of file G4AllocatorList.hh.

Constructor & Destructor Documentation

◆ ~G4AllocatorList()

G4AllocatorList::~G4AllocatorList ( )

Definition at line 59 of file G4AllocatorList.cc.

59{ fAllocatorList = nullptr; }

Member Function Documentation

◆ Destroy()

void G4AllocatorList::Destroy ( G4int  nStat = 0,
G4int  verboseLevel = 0 
)

Definition at line 68 of file G4AllocatorList.cc.

69{
70 auto itr = fList.cbegin();
71 G4int i = 0, j = 0;
72 G4double mem = 0, tmem = 0;
73 if(verboseLevel > 0)
74 {
75 G4cout << "================== Deleting memory pools ==================="
76 << G4endl;
77 }
78 for(; itr != fList.cend(); ++itr)
79 {
80 mem = (*itr)->GetAllocatedSize();
81 if(i < nStat)
82 {
83 ++i;
84 tmem += mem;
85 (*itr)->ResetStorage();
86 continue;
87 }
88 ++j;
89 tmem += mem;
90 if(verboseLevel > 1)
91 {
92 G4cout << "Pool ID '" << (*itr)->GetPoolType()
93 << "', size : " << std::setprecision(3) << mem / 1048576
94 << std::setprecision(6) << " MB" << G4endl;
95 }
96 (*itr)->ResetStorage();
97 delete *itr;
98 }
99 if(verboseLevel > 0)
100 {
101 G4cout << "Number of memory pools allocated: " << Size()
102 << "; of which, static: " << i << G4endl;
103 G4cout << "Dynamic pools deleted: " << j
104 << " / Total memory freed: " << std::setprecision(2)
105 << tmem / 1048576 << std::setprecision(6) << " MB" << G4endl;
106 G4cout << "============================================================"
107 << G4endl;
108 }
109 fList.clear();
110}
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4int Size() const

Referenced by G4RunManagerKernel::~G4RunManagerKernel().

◆ GetAllocatorList()

G4AllocatorList * G4AllocatorList::GetAllocatorList ( )
static

Definition at line 40 of file G4AllocatorList.cc.

41{
42 if(fAllocatorList == nullptr)
43 {
44 fAllocatorList = new G4AllocatorList;
45 }
46 return fAllocatorList;
47}

Referenced by G4AllocatorBase::G4AllocatorBase().

◆ GetAllocatorListIfExist()

G4AllocatorList * G4AllocatorList::GetAllocatorListIfExist ( )
static

Definition at line 50 of file G4AllocatorList.cc.

51{
52 return fAllocatorList;
53}

Referenced by G4RunManagerKernel::G4RunManagerKernel(), and G4RunManagerKernel::~G4RunManagerKernel().

◆ Register()

void G4AllocatorList::Register ( G4AllocatorBase alloc)

Definition at line 62 of file G4AllocatorList.cc.

63{
64 fList.push_back(alloc);
65}

Referenced by G4AllocatorBase::G4AllocatorBase().

◆ Size()

G4int G4AllocatorList::Size ( ) const

Definition at line 113 of file G4AllocatorList.cc.

113{ return fList.size(); }

Referenced by Destroy(), and G4RunManagerKernel::G4RunManagerKernel().


The documentation for this class was generated from the following files: