UbixOS V2 2.0

Macros | Functions | Variables
memp.c File Reference
`#include "net/opt.h"`
`#include "net/memp.h"`
`#include "net/sys.h"`
`#include "net/stats.h"`
`#include <string.h>`
`#include "net/pbuf.h"`
`#include "net/raw.h"`
`#include "net/udp.h"`
`#include "net/tcp.h"`
`#include "net/priv/tcp_priv.h"`
`#include "net/ip4_frag.h"`
`#include "net/netbuf.h"`
`#include "net/api.h"`
`#include "net/priv/tcpip_priv.h"`
`#include "net/priv/api_msg.h"`
`#include "net/sockets.h"`
`#include "net/netifapi.h"`
`#include "net/etharp.h"`
`#include "net/igmp.h"`
`#include "net/timeouts.h"`
`#include "netif/ppp/ppp_opts.h"`
`#include "net/netdb.h"`
`#include "net/dns.h"`
`#include "net/priv/nd6_priv.h"`
`#include "net/ip6_frag.h"`
`#include "net/mld6.h"`
`#include "net/priv/memp_std.h"`
Include dependency graph for memp.c:

Go to the source code of this file.

## Macros
#define | LWIP_MEMPOOL(name, num, size, desc) LWIP_MEMPOOL_DECLARE(name,num,size,desc)
#define | LWIP_MEMPOOL(name, num, size, desc) &memp_ ## name,

## Functions
void | memp_free (memp_t type, void *mem)
void | memp_free_pool (const struct memp_desc *desc, void *mem)
void | memp_init (void)
void | memp_init_pool (const struct memp_desc *desc)
void * | memp_malloc (memp_t type)
void * | memp_malloc_pool (const struct memp_desc *desc)

## Variables
const struct memp_desc *const | memp_pools [MEMP_MAX]

## 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.

## Macro Definition Documentation

## ◆ LWIP_MEMPOOL [1/2]

#define LWIP_MEMPOOL | ( |  | name,
|  |  | num,
|  |  | size,
|  |  | desc
| ) |  | LWIP_MEMPOOL_DECLARE(name,num,size,desc)

Definition at line 78 of file memp.c.

## ◆ LWIP_MEMPOOL [2/2]

#define LWIP_MEMPOOL | ( |  | name,
|  |  | num,
|  |  | size,
|  |  | desc
| ) |  | &memp_ ## name,

Definition at line 78 of file memp.c.

## Function Documentation

## ◆ memp_free()

void memp_free | ( | memp_t | type,
|  | void * | mem
| ) |  |

Put an element back into its pool.

Parameters

  type | the pool where to put mem
  mem | the memp element to free

Definition at line 469 of file memp.c.

References LWIP_ERROR, MEMP_MAX, memp_pools, NULL, and memp_desc::tab.

Referenced by pbuf_free(), and tcpip_callbackmsg_delete().

## ◆ memp_free_pool()

void memp_free_pool | ( | const struct memp_desc * | desc,
|  | void * | mem
| ) |  |

Put a custom pool element back into its pool.

Parameters

  desc | the pool where to put mem
  mem | the memp element to free

Definition at line 452 of file memp.c.

References LWIP_ASSERT, and NULL.

## ◆ memp_init()

void memp_init | ( | void |  | ) |

Initializes lwIP built-in pools. Related functions: memp_malloc, memp_free

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

Definition at line 271 of file memp.c.

References LWIP_ARRAYSIZE, memp_init_pool(), and memp_pools.

Referenced by lwip_init().

Here is the call graph for this function:

## ◆ memp_init_pool()

void memp_init_pool | ( | const struct memp_desc * | desc | ) |

Initialize custom memory pool. Related functions: memp_malloc_pool, memp_free_pool

Parameters

  desc | pool to initialize

Definition at line 230 of file memp.c.

References memp_desc::base, LWIP_MEM_ALIGN, LWIP_UNUSED_ARG, MEMP_OVERFLOW_CHECK, MEMP_SIZE, memp::next, NULL, memp_desc::num, memp_desc::size, and memp_desc::tab.

Referenced by memp_init().

## ◆ memp_malloc()

void* memp_malloc | ( | memp_t | type | ) |

Get an element from a specific pool.

Parameters

  type | the pool to get an element from

Returns
  a pointer to the allocated memory or a NULL pointer on error

Definition at line 385 of file memp.c.

References LWIP_ERROR, MEMP_MAX, and NULL.

Referenced by pbuf_alloc(), and tcpip_callbackmsg_new().

## ◆ memp_malloc_pool()

void* memp_malloc_pool | ( | const struct memp_desc * | desc | ) |

Get an element from a custom pool.

Parameters

  desc | the pool to get an element from

Returns
  a pointer to the allocated memory or a NULL pointer on error

Definition at line 359 of file memp.c.

References LWIP_ASSERT, and NULL.

## Variable Documentation

## ◆ memp_pools

const struct memp_desc* const memp_pools[MEMP_MAX]

Initial value:
= {
#define LWIP_MEMPOOL(name,num,size,desc)
}

Definition at line 81 of file memp.c.

Referenced by memp_free(), and memp_init().