Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 48 of file G4AllocatorList.hh.

Constructor & Destructor Documentation

G4AllocatorList::~G4AllocatorList ( )

Definition at line 57 of file G4AllocatorList.cc.

58 {
59  fAllocatorList = 0;
60 }

Member Function Documentation

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

Definition at line 67 of file G4AllocatorList.cc.

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

Here is the call graph for this function:

Here is the caller graph for this function:

G4AllocatorList * G4AllocatorList::GetAllocatorList ( )
static

Definition at line 39 of file G4AllocatorList.cc.

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

Here is the caller graph for this function:

G4AllocatorList * G4AllocatorList::GetAllocatorListIfExist ( )
static

Definition at line 48 of file G4AllocatorList.cc.

49 {
50  return fAllocatorList;
51 }

Here is the caller graph for this function:

void G4AllocatorList::Register ( G4AllocatorBase alloc)

Definition at line 62 of file G4AllocatorList.cc.

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

Here is the caller graph for this function:

G4int G4AllocatorList::Size ( ) const

Definition at line 111 of file G4AllocatorList.cc.

112 {
113  return fList.size();
114 }

Here is the caller graph for this function:


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