diff --git a/src/core/memp.c b/src/core/memp.c index 8e406659..c570b7e1 100644 --- a/src/core/memp.c +++ b/src/core/memp.c @@ -120,7 +120,7 @@ static u8_t memp_memory[(MEMP_NUM_PBUF * static sys_sem_t mutex; #endif -#ifndef LWIP_NOASSERT +#if MEMP_SANITY_CHECK static int memp_sanity(void) { @@ -140,7 +140,7 @@ memp_sanity(void) } return 1; } -#endif /* LWIP_DEBUG */ +#endif /* MEMP_SANITY_CHECK*/ void memp_init(void) @@ -261,7 +261,9 @@ memp_free(memp_t type, void *mem) memp->next = memp_tab[type]; memp_tab[type] = memp; +#if MEMP_SANITY_CHECK LWIP_ASSERT("memp sanity", memp_sanity()); +#endif #if SYS_LIGHTWEIGHT_PROT SYS_ARCH_UNPROTECT(old_level); diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index 240ae6bd..31dcb0cb 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -67,6 +67,10 @@ a lot of data that needs to be copied, this should be set high. */ #define MEM_SIZE 1600 #endif +#ifndef MEMP_SANITY_CHECK +#define MEMP_SANITY_CHECK 0 +#endif + /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application sends a lot of data out of ROM (or other static memory), this should be set high. */