#include <source/toolbox/memory/FixedArena.h>
Inheritance diagram for SAMRAI::tbox::FixedArena:
Public Member Functions | |
FixedArena (const size_t bytes) | |
virtual | ~FixedArena () |
virtual void * | alloc (const size_t bytes) |
virtual void | free (void *p) |
virtual Pointer< Arena > | allocateArena (const size_t bytes) |
virtual void | printClassData (std::ostream &os) const |
Note that the size of the memory arena must be calculated including alignment space; all memory requests are aligned on boundaries as defined by Arena::align().
SAMRAI::tbox::FixedArena::FixedArena | ( | const size_t | bytes | ) |
SAMRAI::tbox::FixedArena::~FixedArena | ( | ) | [virtual] |
Release the memory associated with the fixed arena. Objects that allocate from a fixed arena must make sure that the arena lives longer than the need for the buffer space. To ensure that the fixed arena lives long enough, objects might wish to cache a smart pointer to the arena object so that the actual arena object is not deleted until all objects using the arena are deleted.
void * SAMRAI::tbox::FixedArena::alloc | ( | const size_t | bytes | ) | [virtual] |
Allocate an aligned portion of memory from the fixed arena. Allocations that exceed the arena space cause the program to abort with a memory overrun exception.
Implements SAMRAI::tbox::Arena.
void SAMRAI::tbox::FixedArena::free | ( | void * | p | ) | [virtual] |
Return allocated memory to the fixed arena. For FixedArena, the memory is not actually returned to the free memory pool until the object is destroyed. Thus, free() is a null operation.
Implements SAMRAI::tbox::Arena.
Allocate a fixed arena of the specified size. Subclasses should override allocateArena() to return the proper subclass type.
void SAMRAI::tbox::FixedArena::printClassData | ( | std::ostream & | os | ) | const [virtual] |
Print out internal class data for debugging.