Deniz Coban / Deneme
Embed: (wiki syntax)

« Back to documentation index

memp.c File Reference

memp.c File Reference

Dynamic pool memory manager. More...

Go to the source code of this file.

Functions

void memp_init (void)
 Initialize this module.
void * memp_malloc (memp_t type)
 Get an element from a specific pool.
void memp_free (memp_t type, void *mem)
 Put an element back into its pool.

Variables

static struct memp *memp_tab[MEMP_MAX] MEM_POSITION
 This array holds the first free element of each pool.
static const u16_t memp_sizes [MEMP_MAX]
 This array holds the element sizes of each pool.
static const u16_t memp_num [MEMP_MAX]
 This array holds the number of elements in each pool.

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.

Definition in file memp.c.


Function Documentation

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

Definition at line 434 of file memp.c.

void memp_init ( void   )

Initialize this module.

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

Definition at line 337 of file memp.c.

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

Definition at line 389 of file memp.c.


Variable Documentation

u8_t memp_memory [MEM_ALIGNMENT - 1 #define LWIP_MEMPOOL(name,num,size,desc) ] MEM_POSITION [static]

This array holds the first free element of each pool.

This array holds a textual description of each pool.

Elements form a linked list.

This is the actual memory used by the pools (all pools in one big block).

Definition at line 117 of file memp.c.

const u16_t memp_num[MEMP_MAX] [static]
Initial value:
 {
#define LWIP_MEMPOOL(name,num,size,desc)  

}

This array holds the number of elements in each pool.

Definition at line 137 of file memp.c.

const u16_t memp_sizes[MEMP_MAX] [static]
Initial value:
 {
#define LWIP_MEMPOOL(name,num,size,desc)  

}

This array holds the element sizes of each pool.

Definition at line 129 of file memp.c.