memp.c File Reference
`#include "lwip/opt.h"`
`#include "lwip/memp.h"`
`#include "lwip/sys.h"`
`#include "lwip/stats.h"`
`#include <string.h>`
`#include "lwip/pbuf.h"`
`#include "lwip/raw.h"`
`#include "lwip/udp.h"`
`#include "lwip/tcp.h"`
`#include "lwip/priv/tcp_priv.h"`
`#include "lwip/altcp.h"`
`#include "lwip/ip4_frag.h"`
`#include "lwip/netbuf.h"`
`#include "lwip/api.h"`
`#include "lwip/priv/tcpip_priv.h"`
`#include "lwip/priv/api_msg.h"`
`#include "lwip/priv/sockets_priv.h"`
`#include "lwip/etharp.h"`
`#include "lwip/igmp.h"`
`#include "lwip/timeouts.h"`
`#include "netif/ppp/ppp_opts.h"`
`#include "lwip/netdb.h"`
`#include "lwip/dns.h"`
`#include "lwip/priv/nd6_priv.h"`
`#include "lwip/ip6_frag.h"`
`#include "lwip/mld6.h"`
`#include "lwip/priv/memp_std.h"`
`#include "path/to/my/lwip_hooks.h"`

## Functions

void | memp_init_pool (const struct memp_desc *desc)
void | memp_init (void)
void * | memp_malloc_pool (const struct memp_desc *desc)
void * | memp_malloc (memp_t type)
void | memp_free_pool (const struct memp_desc *desc, void *mem)
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

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

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

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

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

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

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