tlsf-malloc.h

TLSF-based global memory allocator.

void tlsf_size_walker(void * ptr, msp430_types.h::size_t size, int used, void * user)

Walk the memory pool to print all block sizes and to calculate the total amount of free and used block sizes.

Note

This function is passed to tlsf_walk_pool()

Parameters

ptr:Pointer to the current block.
size:Size of the current block at ptr.
used:Shows whether the current block is used or free.
user:Custom data expected to be of type pointer to tlsf_size_container_t

int tlsf_add_global_pool(void * mem, msp430_types.h::size_t bytes)

Add an area of memory to the global allocator pool.

The first time this function is called, it will automatically perform a tlsf_create() on the global tlsf_control block.

Parameters

mem:Pointer to memory area. Should be aligned to 4 bytes.
bytes:Size in bytes of the memory area.

Return values

  • 0 on success, nonzero on failure.
tlsf_t * _tlsf_get_global_control(void)

Get a pointer to the global tlsf_control block.

Use for debugging purposes only.

struct tlsf_size_container_t

Struct to hold the total sizes of free and used blocks Used for tlsf-malloc.h::tlsf_size_walker()

unsigned free

total free size

unsigned used

total used size