Simpatico  v1.10
List of all members | Static Public Member Functions
Util::Memory Class Reference

Detailed Description

Provides method to allocate array.

The Memory::allocate() method invokes the new operator within a try catch block, and keeps track of the total memory allocated.

Definition at line 28 of file Memory.h.

#include <Memory.h>

Static Public Member Functions

template<typename Data >
static void allocate (Data *&ptr, size_t size)
 Allocate a C array. More...
 
template<typename Data >
static void deallocate (Data *&ptr, size_t size)
 Allocate a C array. More...
 
static int nAllocate ()
 Return number of times allocated was called. More...
 
static int nDeallocate ()
 Return number of times deallocate was called. More...
 
static int total ()
 Return total amount of memory currently allocated. More...
 
static int max ()
 Return the maximum amount of allocated heap memory thus far. More...
 
static int max (MPI::Intracomm &communicator)
 Return max for any processor in communicator. More...
 
static void initStatic ()
 Call this just to guarantee initialization of static memory. More...
 

Member Function Documentation

template<typename Data >
void Util::Memory::allocate ( Data *&  ptr,
size_t  size 
)
static

Allocate a C array.

Allocates a Data array of size elements, assigns ptr the address of the first element.

Definition at line 104 of file Memory.h.

References UTIL_THROW.

Referenced by Util::DArray< Data >::DArray().

template<typename Data >
void Util::Memory::deallocate ( Data *&  ptr,
size_t  size 
)
static

Allocate a C array.

Allocates a Data array of size elements, assigns ptr the address of the first element.

Definition at line 124 of file Memory.h.

References UTIL_THROW.

Referenced by Util::GPArray< Data >::~GPArray(), and Util::GStack< Data >::~GStack().

int Util::Memory::nAllocate ( )
static

Return number of times allocated was called.

Definition at line 34 of file Memory.cpp.

int Util::Memory::nDeallocate ( )
static

Return number of times deallocate was called.

Definition at line 40 of file Memory.cpp.

int Util::Memory::total ( )
static

Return total amount of memory currently allocated.

Definition at line 46 of file Memory.cpp.

int Util::Memory::max ( )
static

Return the maximum amount of allocated heap memory thus far.

This function returns the temporal maximum of total().

Definition at line 52 of file Memory.cpp.

Referenced by DdMd::Simulation::readCommands().

int Util::Memory::max ( MPI::Intracomm &  communicator)
static

Return max for any processor in communicator.

Definition at line 56 of file Memory.cpp.

void Util::Memory::initStatic ( )
static

Call this just to guarantee initialization of static memory.

Definition at line 28 of file Memory.cpp.

Referenced by Util::initStatic().


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