Open Source Tomb Raider Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: t; c-basic-offset: 3 -*- */
  2. /*================================================================
  3. *
  4. * Project : MTK
  5. * Author : Terry 'Mongoose' Hendrix II
  6. * Website : http://www.westga.edu/~stu7440/
  7. * Email : stu7440@westga.edu
  8. * Object :
  9. * License : No use w/o permission (C) 2002 Mongoose
  10. * Comments: Memory testing tool kit
  11. *
  12. *
  13. * This file was generated using Mongoose's C++
  14. * template generator script. <stu7440@westga.edu>
  15. *
  16. *-- History ------------------------------------------------
  17. *
  18. * 2002.03.27:
  19. * Mongoose - Created
  20. ================================================================*/
  21. #include <cstddef>
  22. #ifndef _MEMORY_TEST_H_
  23. #define _MEMORY_TEST_H_
  24. #if defined(DEBUG_MEMORY) && !defined(UNIT_TEST_MEMORY)
  25. #define DEBUG_NEW new(__FILE__, __LINE__)
  26. void *operator new(size_t size, const char *file, int line);
  27. void *operator new [](size_t size, const char *file, int line);
  28. #define DEBUG_DELETE delete_check(__FILE__, __LINE__, 0);delete
  29. void operator delete(void *p);
  30. void operator delete [](void *p);
  31. #else
  32. #define DEBUG_NEW new
  33. #define DEBUG_DELETE delete
  34. #endif
  35. #define new DEBUG_NEW
  36. #define delete DEBUG_DELETE
  37. void delete_check(const char *file, int line, int print);
  38. void display_memory_usage();
  39. long memory_used();
  40. /*------------------------------------------------------
  41. * Pre :
  42. * Post : Returns amount of total memory used
  43. *
  44. *-- History ------------------------------------------
  45. *
  46. * 2002.03.27:
  47. * Mongoose - Created
  48. ------------------------------------------------------*/
  49. void dump_memory_report();
  50. /*------------------------------------------------------
  51. * Pre :
  52. * Post : Dumps raw Tree holding memory accounting
  53. *
  54. *-- History ------------------------------------------
  55. *
  56. * 2002.03.27:
  57. * Mongoose - Created
  58. ------------------------------------------------------*/
  59. #ifdef DEBUG_MEMORY
  60. #define DWORD unsigned long
  61. #define ZERO_ALLOC_SLOTS 3
  62. typedef enum { RB_BLACK = 0, RB_RED = 1 } rbtree_color_t;
  63. typedef struct rbtree_s {
  64. void *data;
  65. DWORD key;
  66. rbtree_color_t color;
  67. struct rbtree_s *left;
  68. struct rbtree_s *right;
  69. struct rbtree_s *parent;
  70. } rbtree_t;
  71. typedef struct meminfo_filename_s {
  72. char *filename;
  73. char filename_len;
  74. DWORD size;
  75. unsigned int alloc_zero;
  76. unsigned short int alloc_zero_at_line[ZERO_ALLOC_SLOTS];
  77. struct meminfo_filename_s *next;
  78. } meminfo_filename_t;
  79. #endif
  80. #endif