NGSolve
5.3
|
Optimized memory handler. More...
#include <localheap.hpp>
Public Types | |
enum | { ALIGN = 32 } |
Public Member Functions | |
NGS_DLL_HEADER | LocalHeap (size_t asize, const char *aname="noname") |
Allocate one block of size asize. | |
INLINE | LocalHeap (char *adata, size_t asize, const char *aname) throw () |
Use provided memory for the LocalHeap. | |
INLINE | LocalHeap (const LocalHeap &lh2) |
Use provided memory for the LocalHeap. | |
INLINE | LocalHeap (LocalHeap &&lh2) |
INLINE | ~LocalHeap () |
free memory | |
INLINE void | CleanUp () throw () |
delete all memory on local heap | |
INLINE void * | GetPointer () throw () |
returns heap-pointer | |
INLINE void | CleanUp (void *addr) throw () |
deletes memory back to heap-pointer | |
INLINE void * | Alloc (size_t size) |
allocates size bytes of memory from local heap | |
template<typename T > | |
INLINE T * | Alloc (size_t size) |
allocates size objects of type T on local heap | |
INLINE void | Free (void *data) throw () |
free memory (dummy function) | |
INLINE size_t | Available () const throw () |
available memory on LocalHeap | |
INLINE LocalHeap | Split () const |
Split free memory on heap into pieces for each openmp-thread. | |
INLINE void | ClearValues () |
INLINE size_t | UsedSize () |
Public Attributes | |
bool | owner |
const char * | name |
Optimized memory handler.
One block of data is organized as stack memory. One can allocate memory out of it. This increases the stack pointer. With {CleanUp}, the pointer is reset to the beginning or to a specific position.