deds_alloc.htm 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
  2. <html><head>
  3. <title>alloc</title>
  4. </head><body>
  5. <p>[<a href="mxdoc.htm">mainpage</a>]
  6. [<a href="tags.htm">tags</a>]<br>
  7. <h1><a name="alloc">module: alloc</a></h1><p><b>Wrappers for C memory management functions with error checking</b><p>
  8. This module contains macros and functions that perform as wrappers
  9. for standard C memory management functions, malloc, realloc and free. The
  10. wrapper functions check for incorrect use realloc and free, memory overrun
  11. errors and double free errors. If, at program termination, that memory has
  12. not been properly free'd then error messages are written to stderr with the
  13. unfreed memory allocations. Logging of all memory management function calls
  14. to stderr can be turned on to aid in debugging. The wrappers can be 'turned
  15. off' at compile time for zero overhead.
  16. (<a href="../include/deds/alloc.h">../include/deds/alloc.h</a>)<p>Part of the <a href="deds.htm">deds</a> library.<ul><li>
  17. <a name=" define MXMODULE_ALLOC"><code># define MXMODULE_ALLOC</code></a>
  18. <p>
  19. <p><b>Turn on memory tracking</b><p>
  20. If this macro is defined the functions mx_malloc, mx_realloc and mx_free
  21. are made to keep track of memory allocated and warn from common memory allocation
  22. mistakes. If this symbol is not defined then mx_malloc, mx_realloc and mx_free
  23. just pass all arguments to the corresponding stdlib malloc, realloc, and free
  24. function. In this case no additional memory checking is done.
  25. (<a href="../include/deds/alloc.h">../include/deds/alloc.h</a>)<p></li>
  26. <li>
  27. <a name=" define mx_malloc"><code># define mx_malloc</code></a>
  28. <p>
  29. <p><b>Replacement for stdlib malloc</b><p>
  30. This function is a wrapper for malloc(). If MXMODULE_ALLOC is defined then
  31. this function keeps track of memory and warns about possible memory allocation
  32. problems.
  33. (<a href="../include/deds/alloc.h">../include/deds/alloc.h</a>)<p></li>
  34. <li>
  35. <a name=" define mx_realloc"><code># define mx_realloc</code></a>
  36. <p>
  37. <p><b>Replacement for stdlib realloc</b><p>
  38. This function is a wrapper for realloc(). If MXMODULE_ALLOC is defined then
  39. this function keeps track of memory and warns about possible memory allocation
  40. problems.
  41. (<a href="../include/deds/alloc.h">../include/deds/alloc.h</a>)<p></li>
  42. <li>
  43. <a name=" define mx_free"><code># define mx_free</code></a>
  44. <p>
  45. <p><b>Replacement for stdlib free</b><p>
  46. This function is a wrapper for free(). If MXMODULE_ALLOC is defined then
  47. this function keeps track of memory and warns about possible memory allocation
  48. problems.
  49. (<a href="../include/deds/alloc.h">../include/deds/alloc.h</a>)<p></li>
  50. <li>
  51. <a name=" define MXDEBUG_ALLOCTAG(p)"><code># define MXDEBUG_ALLOCTAG(p)</code></a>
  52. <p>
  53. <p><b>Tag an allocation (debug)</b><p>
  54. This macro tags a pointer to memory with the current filename and source line.
  55. If the pointer does not exist the the current allocation list then this macro does nothing.
  56. If memory debugging is off (MXMODULE_ALLOC undefined or NDEBUG is defined) then
  57. this macro compiles to nothing.
  58. (<a href="../include/deds/alloc.h">../include/deds/alloc.h</a>)<p></li>
  59. <li>
  60. <a name=" define MXDEBUG_ALLOCCHECK()"><code># define MXDEBUG_ALLOCCHECK()</code></a>
  61. <p>
  62. <p><b>Check all allocations</b><p>
  63. This macro causes all allocations to be checked for over/under writing.
  64. If memory debugging is off (MXMODULE_ALLOC undefined or NDEBUG is defined) then
  65. this macro compiles to nothing.
  66. (<a href="../include/deds/alloc.h">../include/deds/alloc.h</a>)<p></li>
  67. </ul><p>Generated by <a href="http://www.deleveld.dds.nl/mxdoc/index.htm">MXDOC</a> 2.2 on Sun Feb 4 15:16:26 2007
  68. </body></html>