Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions
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.

References G4cout, G4endl, and Size().

Referenced by G4RunManagerKernel::~G4RunManagerKernel().

68 {
69  std::vector<G4AllocatorBase*>::iterator itr=fList.begin();
70  G4int i=0, j=0;
71  G4double mem=0;
72  for(; itr!=fList.end();++itr)
73  {
74  if(i<nStat)
75  {
76  i++;
77  mem += (*itr)->GetAllocatedSize();
78  (*itr)->ResetStorage();
79  continue;
80  }
81  j++;
82  mem += (*itr)->GetAllocatedSize();
83  (*itr)->ResetStorage();
84  delete *itr;
85  }
86  if(verboseLevel>0)
87  {
88  G4cout << "================== Deleting memory pools ==================="
89  << G4endl;
90  G4cout << "Number of memory pools allocated: " << Size()
91  << "; of which, static: " << i << G4endl;
92  G4cout << "Dynamic pools deleted: " << j
93  << " / Total memory freed: " << std::setprecision(2)
94  << mem/1048576 << std::setprecision(6) << " Mb" << G4endl;
95  G4cout << "============================================================"
96  << G4endl;
97  }
98  fList.clear();
99 }
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
G4AllocatorList * G4AllocatorList::GetAllocatorList ( )
static

Definition at line 39 of file G4AllocatorList.cc.

Referenced by G4AllocatorBase::G4AllocatorBase().

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

Definition at line 48 of file G4AllocatorList.cc.

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

49 {
50  return fAllocatorList;
51 }
void G4AllocatorList::Register ( G4AllocatorBase alloc)

Definition at line 62 of file G4AllocatorList.cc.

Referenced by G4AllocatorBase::G4AllocatorBase().

63 {
64  fList.push_back(alloc);
65 }
G4int G4AllocatorList::Size ( ) const

Definition at line 101 of file G4AllocatorList.cc.

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

102 {
103  return fList.size();
104 }

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