/** * @file nstdc_mem.h * @brief メモリに関するモジュール * @author Nomura Kei * @copyright 2003 - 2017 Nomura Kei * License: New BSD License (3-cclause BSD license) */ #ifndef NSTDC_MEM_H #define NSTDC_MEM_H #include <nstdc.h> /** * メモリの種別. */ typedef enum { NSTDC_ALLOC_TYPE_ALLOC = 0xA6090000UL; NSTDC_ALLOC_TYPE_ALLOC_NEW = 0xA609F001UL; NSTDC_ALLOC_TYPE_ALLOC_NEW_ARRAY = 0xA609FF02UL; NSTDC_ALLOC_TYPE_DELETED = 0xA609FFF3UL; } NstdcAllocType; /** * メモリ管理情報. */ typedef struct MemoryInfoStruct { struct MemoryInfoStruct* _prev; struct MemoryInfoStruct* _next; const char* filename; /**< メモリ確保ファイル名 */ int line; /**< メモリ確保行番号 */ const char* func; /**< メモリ確保関数 */ MemoryAllocType type; /**< メモリ種別 */ size_t size; /**< 確保したメモリサイズ */ void* data; /**< 確保したメモリ領域へのポインタ */ } MemoryInfo; #if __cplusplus extern "C" { #endif void nstdc_set_memhandler(void (*handler)(MemoryInfo* info)); #if __cplusplus } #endif #endif /* NSTDC_MEM_H */