Geant4-11
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
G4AllocatorList Class Reference

#include <G4AllocatorList.hh>

Public Member Functions

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

Static Public Member Functions

static G4AllocatorListGetAllocatorList ()
 
static G4AllocatorListGetAllocatorListIfExist ()
 

Private Member Functions

 G4AllocatorList ()
 

Private Attributes

std::vector< G4AllocatorBase * > fList
 

Static Private Attributes

static G4ThreadLocal G4AllocatorListfAllocatorList = nullptr
 

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; }
static G4ThreadLocal G4AllocatorList * fAllocatorList

References fAllocatorList.

◆ G4AllocatorList()

G4AllocatorList::G4AllocatorList ( )
private

Definition at line 56 of file G4AllocatorList.cc.

56{}

Referenced by GetAllocatorList().

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
std::vector< G4AllocatorBase * > fList

References fList, G4cout, G4endl, and Size().

Referenced by G4RunManagerKernel::~G4RunManagerKernel().

◆ GetAllocatorList()

G4AllocatorList * G4AllocatorList::GetAllocatorList ( )
static

Definition at line 40 of file G4AllocatorList.cc.

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

References fAllocatorList, and G4AllocatorList().

Referenced by G4AllocatorBase::G4AllocatorBase().

◆ GetAllocatorListIfExist()

G4AllocatorList * G4AllocatorList::GetAllocatorListIfExist ( )
static

Definition at line 50 of file G4AllocatorList.cc.

51{
52 return fAllocatorList;
53}

References fAllocatorList.

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}

References fList.

Referenced by G4AllocatorBase::G4AllocatorBase().

◆ Size()

G4int G4AllocatorList::Size ( ) const

Definition at line 113 of file G4AllocatorList.cc.

113{ return fList.size(); }

References fList.

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

Field Documentation

◆ fAllocatorList

G4ThreadLocal G4AllocatorList * G4AllocatorList::fAllocatorList = nullptr
staticprivate

Definition at line 58 of file G4AllocatorList.hh.

Referenced by GetAllocatorList(), GetAllocatorListIfExist(), and ~G4AllocatorList().

◆ fList

std::vector<G4AllocatorBase*> G4AllocatorList::fList
private

Definition at line 59 of file G4AllocatorList.hh.

Referenced by Destroy(), Register(), and Size().


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