Barrelfish
Functions
memp.c File Reference

Functions

u8_t * mem_barrelfish_alloc (uint8_t buf_index, uint32_t size)
 
void memp_init (void)
 
void * memp_malloc (memp_t type)
 
void memp_free (memp_t type, void *mem)
 

Detailed Description

Dynamic pool memory manager

lwIP has dedicated pools for many structures (netconn, protocol control blocks, packet buffers, ...). All these pools are managed here.

Function Documentation

u8_t* mem_barrelfish_alloc ( uint8_t  binding_index,
uint32_t  size 
)

Used to allocate memory for RX/TX buffers in lwip. At the moment it must * only be called once for each binding (2 total).

void memp_free ( memp_t  type,
void *  mem 
)

Put an element back into its pool.

Parameters
typethe pool where to put mem
memthe memp element to free
void memp_init ( void  )

Initialize this module.

Carves out memp_memory into linked lists for each pool-type.

void* memp_malloc ( memp_t  type)

Get an element from a specific pool.

Parameters
typethe pool to get an element from

the debug version has two more parameters:

Parameters
filefile name calling this function
linenumber of line where this function is called
Returns
a pointer to the allocated memory or a NULL pointer on error