47 #define USE_MALLOC_INSTEAD 1 48 #define MOCK_LEA_HEAP_ID ((UINTPTR)(-1)) 49 #define system_malloc my_malloc 50 #define system_free my_free 58 #define DEFAULT_GRANULARITY (32U*1024U) 72 #define ONLY_MSPACES 1 87 #define MMAP_TRACE_H_SIZE sizeof(MMAP_TRACE_H) 89 #define MMAP_TRACE_H_INIT(h, p) do { \ 90 MMAP_TRACE_H *__h = (h); \ 91 (__h)->next = (__h)->prev = (__h); \ 95 #define MMAP_TRACE_H_REMOVE(h) do { \ 96 MMAP_TRACE_H *__h = (h); \ 97 (__h)->next->prev = (__h)->prev; \ 98 (__h)->prev->next = (__h)->next; \ 101 #define MMAP_TRACE_H_ADD(p, h) do { \ 102 MMAP_TRACE_H *__ih = (p); \ 103 MMAP_TRACE_H *__bh = (h); \ 104 (__ih)->prev = (__bh); \ 105 (__ih)->next = (__bh)->next; \ 106 (__bh)->next->prev = (__ih); \ 107 (__bh)->next = (__ih); \ 113 #define ENABLE_SEPARATE_MMAP_EVENT_TRACE 124 void *
ptr = malloc (sz);
170 #define mspace2hlmspace(m) \ 171 (HL_MSPACE *)((char *)mem2chunk(m) - ((sizeof (HL_MSPACE) + 7U) & ~7U)) 206 #define LEA_HEAP_BASE_SIZE (64U*1024U) 215 #if !defined (NDEBUG) 231 hms->
base = (
char *) hms + ((
sizeof (*hms) + 7U) & ~7U);
242 return ((UINTPTR) hms);
254 destroy_mspace (hms->
ms);
274 #if !defined (NDEBUG) 301 #if !defined (NDEBUG) 328 #if !defined (NDEBUG) 341 p = mspace_malloc (hms->
ms, sz);
363 #if !defined (NDEBUG) 366 return realloc (ptr, sz);
376 p = mspace_realloc (hms->
ms, ptr, sz);
397 #if !defined (NDEBUG) 409 mspace_free (hms->
ms, ptr);
void * hl_lea_realloc(UINTPTR heap_id, void *ptr, size_t sz)
#define MMAP_TRACE_H_ADD(p, h)
#define MMAP_TRACE_H_REMOVE(h)
#define MMAP_TRACE_H_INIT(h, p)
void hl_lea_free(UINTPTR heap_id, void *ptr)
struct malloc_state * mstate
void * hl_lea_alloc(UINTPTR heap_id, size_t sz)
static void destroy_mspace_internal(HL_MSPACE *hms)
void er_set(int severity, const char *file_name, const int line_no, int err_id, int num_args,...)
static void mmap_called(void *m, void *ptr, MMAP_TRACE_H *h)
#define LEA_HEAP_BASE_SIZE
#define ER_OUT_OF_VIRTUAL_MEMORY
UINTPTR hl_register_lea_heap(void)
static int my_free(void *p)
#define mspace2hlmspace(m)
void hl_clear_lea_heap(UINTPTR heap_id)
static void * my_malloc(size_t sz)
static void munmap_is_to_be_called(void *m, void *ptr, MMAP_TRACE_H *h)
bool prm_get_bool_value(PARAM_ID prm_id)
void hl_unregister_lea_heap(UINTPTR heap_id)