|
IBAMR
IBAMR version 0.19.
|
#include <tbox/FixedArena.h>

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 |
Static Public Member Functions | |
| static size_t | align (const size_t bytes) |
Private Types | |
| enum | { ArenaAllocationAlignment = 16 } |
Private Member Functions | |
| FixedArena (const FixedArena &) | |
| void | operator= (const FixedArena &) |
Private Attributes | |
| Pointer< Arena > | d_arena |
| void * | d_pool |
| size_t | d_size |
| size_t | d_used |
Class FixedArena implements a very simple fixed-size memory management scheme. One large chunk of a known size is allocated and then further allocation requests take memory from that pool. Memory is never returned to the local pool via free, although memory is freed when the object exits.
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 | ) |
|
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.
|
private |
|
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.
|
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.
|
virtual |
Print out internal class data for debugging.
|
private |
|
staticinherited |
Static arena function to compute alignment for memory allocation. Data allocations less than the alignment size are rounded up to the next multiple of the allocation size. All data allocations are aligned on 16 byte boundaries. Thus, a memory allocation of only 9 bytes will actually return a 16 byte chunk of memory.
|
private |
|
private |
|
private |
1.8.17