Newer
Older
libkc / modules / src / kc_memory_mark.c
Nomura Kei on 31 May 2024 949 bytes update for windows
  1.  
  2. /**
  3. * @file kc_memory_mark.c
  4. * @brief KC メモリ管理 メモリ状態を扱うサブモジュール (mark)
  5. * @copyright 2003 - 2023 Nomura Kei
  6. */
  7. #include <kc_memory_mark.h>
  8.  
  9. /**
  10. * 指定されたメモリ状態(mark)に対応する文字列表現を返します。
  11. * 返される文字列は、次の通り
  12. * - alloc : malloc, calloc, realloc によりメモリが確保された
  13. * - new : new によりメモリが確保された
  14. * - new[] : new[] によりメモリが確保された
  15. * - delete : 削除済みメモリ
  16. * - other : 不明
  17. *
  18. * @param mark メモリ状態
  19. * @return メモリ状態に対応する文字列表現
  20. */
  21. const char *KcMemoryMark_to_string(int mark)
  22. {
  23. switch (mark)
  24. {
  25. case KC_MEMORY_DELETED:
  26. return "delete";
  27. case KC_MEMORY_ALLOCATED:
  28. return "alloc ";
  29. case KC_MEMORY_ALLOCATED_ALIGNED:
  30. return "alloca";
  31. default:
  32. return "other ";
  33. }
  34. }