Newer
Older
libkc / modules / include / kc_memory_mark.h
  1. /**
  2. * @file kc_memory_mark.h
  3. * @brief KC メモリ管理 メモリ状態を扱うサブモジュール (mark)
  4. * @copyright 2003 - 2023 Nomura Kei
  5. * @depends
  6. * kc.h
  7. *
  8. * 本ヘッダファイルを直接 include せず、kc_memory.h を include してください。
  9. */
  10. #ifndef KC_MEMORY_MARK_H
  11. #define KC_MEMORY_MARK_H
  12.  
  13. #include <kc.h>
  14.  
  15. #ifdef __cplusplus
  16. extern "C"
  17. {
  18. namespace kc
  19. {
  20. using namespace std;
  21. #endif
  22.  
  23. /**
  24. * メモリ状態
  25. */
  26. typedef enum
  27. {
  28. KC_MEMORY_DELETED = 0x55AA0000, //!< 解放済み
  29. KC_MEMORY_ALLOCATED = 0x55AA1111, //!< 確保済み
  30. KC_MEMORY_ALLOCATED_NEW = 0x55AA2222, //!< new により確保済み
  31. KC_MEMORY_ALLOCATED_NEW_ARRAY = 0x55AA4444 //!< new[] により確保済み
  32. } KcMemoryMark;
  33.  
  34. /**
  35. * 指定されたメモリ状態に対応する文字列表現を返します。
  36. * 返される文字列は、次の通り
  37. * - alloc : malloc, calloc, realloc によりメモリが確保された
  38. * - new : new によりメモリが確保された
  39. * - new[] : new[] によりメモリが確保された
  40. * - delete : 削除済みメモリ
  41. * - other : 不明
  42. *
  43. * @param mark メモリ状態
  44. * @return メモリ状態に対応する文字列表現
  45. */
  46. const char *KcMemoryMark_to_string(int mark);
  47.  
  48. #ifdef __cplusplus
  49. } // namespace kc
  50. } // extern "C"
  51. #endif
  52. #endif // KC_MEMORY_MARK_H