ReactOS 0.4.16-dev-306-g647d351
|
#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 0 |
Set this to 1 if you want to free PBUF_RAM pbufs (or call mem_free()) from interrupt context (or another context that doesn't allow waiting for a semaphore). If set to 1, mem_malloc will be protected by a semaphore and SYS_ARCH_PROTECT, while mem_free will only use SYS_ARCH_PROTECT. mem_malloc SYS_ARCH_UNPROTECTs with each loop so that mem_free can run.
ATTENTION: As you can see from the above description, this leads to dis-/ enabling interrupts often, which can be slow! Also, on low memory, mem_malloc can need longer.
If you don't want that, at least for NO_SYS=0, you can still use the following functions to enqueue a deallocation call which then runs in the tcpip_thread context:
#define MEM_ALIGNMENT 1 |
#define MEM_LIBC_MALLOC 0 |
#define MEM_OVERFLOW_CHECK 0 |
MEM_OVERFLOW_CHECK: mem overflow protection reserves a configurable amount of bytes before and after each heap allocation chunk and fills it with a prominent default value. MEM_OVERFLOW_CHECK == 0 no checking MEM_OVERFLOW_CHECK == 1 checks each element when it is freed MEM_OVERFLOW_CHECK >= 2 checks all heap elements every time mem_malloc() or mem_free() is called (useful but slow!)
#define MEM_SANITY_CHECK 0 |
MEM_SANITY_CHECK==1: run a sanity check after each mem_free() to make sure that the linked list of heap elements is not corrupted.
#define MEM_SIZE 1600 |
#define MEM_USE_POOLS 0 |
MEM_USE_POOLS==1: Use an alternative to malloc() by allocating from a set of memory pools of various sizes. When mem_malloc is called, an element of the smallest pool that can provide the length needed is returned. To use this, MEMP_USE_CUSTOM_POOLS also has to be enabled.
#define MEM_USE_POOLS_TRY_BIGGER_POOL 0 |
#define MEMP_MEM_INIT 0 |
#define MEMP_MEM_MALLOC 0 |
MEMP_MEM_MALLOC==1: Use mem_malloc/mem_free instead of the lwip pool allocator. Especially useful with MEM_LIBC_MALLOC but handle with care regarding execution speed (heap alloc can be much slower than pool alloc) and usage from interrupts (especially if your netif driver allocates PBUF_POOL pbufs for received frames from interrupt)! ATTENTION: Currently, this uses the heap for ALL pools (also for private pools, not only for internal pools defined in memp_std.h)!
#define MEMP_OVERFLOW_CHECK 0 |
MEMP_OVERFLOW_CHECK: memp overflow protection reserves a configurable amount of bytes before and after each memp element in every pool and fills it with a prominent default value. MEMP_OVERFLOW_CHECK == 0 no checking MEMP_OVERFLOW_CHECK == 1 checks each element when it is freed MEMP_OVERFLOW_CHECK >= 2 checks each element in every pool every time memp_malloc() or memp_free() is called (useful but slow!)
#define MEMP_SANITY_CHECK 0 |
MEMP_SANITY_CHECK==1: run a sanity check after each memp_free() to make sure that there are no cycles in the linked lists.