Addition to patch #5913: decrease size of memp_memory.

Added option MEMP_OVERFLOW_CHECK to check for memp elements to overflow.
This commit is contained in:
goldsimon
2007-05-18 19:48:44 +00:00
parent cde11f9d9c
commit a4f4e6e71d
4 changed files with 164 additions and 21 deletions

View File

@@ -62,7 +62,12 @@ typedef enum {
void memp_init(void);
#if MEMP_OVERFLOW_CHECK
void *memp_malloc_fn(memp_t type, const char* file, const int line);
#define memp_malloc(t) memp_malloc_fn((t), __FILE__, __LINE__)
#else
void *memp_malloc(memp_t type);
#endif
void memp_free(memp_t type, void *mem);
#ifdef __cplusplus

View File

@@ -84,8 +84,18 @@ a lot of data that needs to be copied, this should be set high. */
#define MEM_SIZE 1600
#endif
/* 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 = 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!) */
#ifndef MEMP_OVERFLOW_CHECK
#define MEMP_OVERFLOW_CHECK 0
#endif
#ifndef MEMP_SANITY_CHECK
#define MEMP_SANITY_CHECK 0
#define MEMP_SANITY_CHECK 0
#endif
/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application