ref: 4a34b0e05d1f1aa34485d770df9406f80cb90da1
dir: /src/mem.h/
#if !defined(HEAP_SIZE0) #define HEAP_SIZE0 4*1024*1024 #endif #if !defined(STACK_SIZE0) #define STACK_SIZE0 64*1024 #endif #if !defined(ALLOC_LIMIT_TRIGGER) #define ALLOC_LIMIT_TRIGGER HEAP_SIZE0 #endif #if defined(USE_DLMALLOC) void *sl_malloc(size_t); void sl_free(void *); void *sl_calloc(size_t, size_t); void *sl_realloc(void *, size_t); char *sl_strdup(const char *s); #define MEM_CALLOC(n, sz) sl_calloc((size_t)(n), (size_t)(sz)) #define MEM_ALLOC(n) sl_malloc((size_t)(n)) #define MEM_REALLOC(p, n) sl_realloc((p), (size_t)(n)) #define MEM_FREE(x) sl_free(x) #define MEM_STRDUP(s) sl_strdup(s) #define sl_segalloc(sz) MEM_ALLOC((size_t)sz) #define sl_segfree(s, sz) MEM_FREE(s) #else #define MEM_CALLOC(n, sz) calloc((size_t)(n), (size_t)(sz)) #define MEM_ALLOC(n) malloc((size_t)(n)) #define MEM_REALLOC(p, n) realloc((p), (size_t)(n)) #define MEM_FREE(x) free(x) #define MEM_STRDUP(s) strdup(s) void *sl_segalloc(size_t sz); void sl_segfree(void *s, size_t sz); #endif