memdebug.h 583 B

12345678910111213141516171819202122232425
  1. /* Functions used for debugging memory leaks within libfmi. The idea is to wrap calls to calloc and free and monitor
  2. memory usage. */
  3. #ifdef MEMLEAK_DEBUG
  4. #ifndef memdebug_h
  5. #include <stddef.h>
  6. /* Setup memory debug (no teardown necessary). All calls but the first are ignored. */
  7. void memdebug_setup();
  8. /* Wrapper for calloc */
  9. void* memdebug_calloc(size_t nobj, size_t size);
  10. /* Wrapper for free */
  11. void memdebug_free(void* obj);
  12. /* Checks whether calloc:s and free:s used so far matches up. */
  13. void memdebug_check();
  14. #endif /* memdebug_h */
  15. #endif /* MEMLEAK_DEBUG */