PitchHut logo
Memory Manager - Fast, Scalable and Easy to use
Pitch

TBMAN is a general-purpose memory manager offering functions tbman_malloc, tbman_free, tbman_realloc, which can can be used like stdlib functions malloc, free, realloc, in C and C++ code.

TBMAN is fast and scalable with a unique internal design.

Description

Basics

Tbman offers the three basic functions of a memory manager:

void* tbman_malloc(             size_t size ); // pure allocation
void* tbman_realloc( void* ptr, size_t size ); // reallocation
void  tbman_free(    void* ptr              ); // freeing

Usage and behavior is compatible to corresponding stdlib functions malloc, free, realloc.
Exception: Should the entire system run out of available memory, tbman aborts with an error message to stderr.

One function for everything

Alternatively, you can use just one of the following two functions for all memory management including some special features of tbman.

void* tbman_alloc(  void* current_ptr,                      size_t requested_size, size_t* granted_size );
void* tbman_nalloc( void* current_ptr, size_t current_size, size_t requested_size, size_t* granted_size );

Advanced Alignment

Tbman aligns the memory instance selectively. This covers all standard C/C++ data types char, short, int, float, double, etc and also larger types such as int32x4_t, float32x4_t, etc, which are typically used for SIMD-extensions such as SSE, AVX, NEON, etc.

Example:

int32x4_t* my_data = tbman_malloc( sizeof( int32x4_t ) * 10 ); // aligned array of 10 x int32x4_t

Granted Memory

For design reasons, tbman might find no proper use for some space immediately following your requested memory block. In that case, it grants you that extra space, appending it to your request. You may use the granted space as if you had requested it in the first place.
(Note: Tbman never grants less than requested.)


Impressum

0 comments

No comments yet.

Sign in to be the first to comment.