ex

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Committer:
TMBOY
Date:
Tue Jul 18 16:54:45 2017 +0800
Revision:
47:9e361da97763
?

Who changed what in which revision?

UserRevisionLine numberNew contents of line
TMBOY 47:9e361da97763 1 #ifndef _HEAP_MONITOR_H_
TMBOY 47:9e361da97763 2 #define _HEAP_MONITOR_H_
TMBOY 47:9e361da97763 3
TMBOY 47:9e361da97763 4 #ifdef HEAP_MONITOR
TMBOY 47:9e361da97763 5 #define MALLOC(size, module) malloc_t(size, module)
TMBOY 47:9e361da97763 6 #define REALLOC(ptr, size, module) realloc_t(ptr, size, module)
TMBOY 47:9e361da97763 7 #define CALLOC(nmemb, size, module) calloc_t(nmemb, size, module)
TMBOY 47:9e361da97763 8 #define FREE(ptr) free_t(ptr)
TMBOY 47:9e361da97763 9 #define NEW(module) new (module)
TMBOY 47:9e361da97763 10
TMBOY 47:9e361da97763 11 #ifdef __cplusplus
TMBOY 47:9e361da97763 12 extern "C" {
TMBOY 47:9e361da97763 13 #endif
TMBOY 47:9e361da97763 14
TMBOY 47:9e361da97763 15 enum module {
TMBOY 47:9e361da97763 16 OS = 0,
TMBOY 47:9e361da97763 17 APP = 1,
TMBOY 47:9e361da97763 18 OTA = 2,
TMBOY 47:9e361da97763 19 CA = 3,
TMBOY 47:9e361da97763 20 HTTP = 4,
TMBOY 47:9e361da97763 21 MEDIA = 5,
TMBOY 47:9e361da97763 22 RECORDER = 6,
TMBOY 47:9e361da97763 23 SPEEX_LIB = 7,
TMBOY 47:9e361da97763 24 MAX_MODULE = 8,
TMBOY 47:9e361da97763 25 };
TMBOY 47:9e361da97763 26
TMBOY 47:9e361da97763 27 extern void init_heap_info(void);
TMBOY 47:9e361da97763 28 extern void show_heap_info(void);
TMBOY 47:9e361da97763 29 extern void *malloc_t(size_t size, enum module module);
TMBOY 47:9e361da97763 30 extern void *calloc_t(size_t nmemb, size_t size, enum module module);
TMBOY 47:9e361da97763 31 extern void *realloc_t(void *ptr, size_t size, enum module module);
TMBOY 47:9e361da97763 32 extern void free_t(void *ptr);
TMBOY 47:9e361da97763 33
TMBOY 47:9e361da97763 34 #ifdef __cplusplus
TMBOY 47:9e361da97763 35 }
TMBOY 47:9e361da97763 36
TMBOY 47:9e361da97763 37 void * operator new(std::size_t size, int module);
TMBOY 47:9e361da97763 38 void * operator new[](std::size_t size, int module);
TMBOY 47:9e361da97763 39
TMBOY 47:9e361da97763 40 #endif
TMBOY 47:9e361da97763 41
TMBOY 47:9e361da97763 42 #else
TMBOY 47:9e361da97763 43 #define MALLOC(size, module) malloc(size)
TMBOY 47:9e361da97763 44 #define REALLOC(ptr, size, module) realloc(ptr, size)
TMBOY 47:9e361da97763 45 #define CALLOC(nmemb, size, module) calloc(nmemb, size)
TMBOY 47:9e361da97763 46 #define FREE(ptr) free(ptr)
TMBOY 47:9e361da97763 47 #define NEW(module) new
TMBOY 47:9e361da97763 48 #endif // HEAP_MONITOR
TMBOY 47:9e361da97763 49
TMBOY 47:9e361da97763 50 #endif