Geant4 11.1.1
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)
 
std::size_t 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 56 of file G4AllocatorList.cc.

56{ fAllocatorList = nullptr; }

Member Function Documentation

◆ Destroy()

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

Definition at line 65 of file G4AllocatorList.cc.

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

60{
61 fList.push_back(alloc);
62}

Referenced by G4AllocatorBase::G4AllocatorBase().

◆ Size()

std::size_t G4AllocatorList::Size ( ) const
inline

Definition at line 63 of file G4AllocatorList.hh.

64{
65 return fList.size();
66}

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


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