In file libs/cs3d/common/memheap.h:

class MemoryHeap

This class is intended to manage a memory area and allocate buffer space from that area

Public Methods

char* alloc( size_t s )
int free( void *buf )
To free an allocated buffer in heap

Return value: Success(0), Failure(-1)

MemoryHeap(size_t s = DEFAULT_CACHE_SIZE)
s: Size of Memory heap
char* realloc( void *buf, size_t ns )
Modify the size of a currently allocated buffer to a new size, either by extending the current buffer or moving it to a new location inside the heap
~MemoryHeap()

Private Fields

char* memory
Address of the memory buffer

Documentation

This class is intended to manage a memory area and allocate buffer space from that area.

The buffers are allocated on a first fit basis. To maximize the use of the first memory pages, the list is always scanned in full, merging adjacent empty buffers if found.

If merging buffers fails to allocate sufficient area, then compaction is not tried. This makes it possible to use the buffer pointers directly by the application program.

MemoryHeap(size_t s = DEFAULT_CACHE_SIZE)
s: Size of Memory heap

~MemoryHeap()

char* alloc( size_t s )

char* realloc( void *buf, size_t ns )
Modify the size of a currently allocated buffer to a new size, either by extending the current buffer or moving it to a new location inside the heap.

buf: Currently allocated buffer

ns : New requested size

int free( void *buf )
To free an allocated buffer in heap

Return value: Success(0), Failure(-1)

char* memory
Address of the memory buffer


This class has no child classes.

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de