Profiling.cpp 368 B

123456789101112131415161718192021
  1. #include "../../Include/RmlUi/Core/Profiling.h"
  2. #ifdef RMLUI_TRACY_MEMORY_PROFILING
  3. #include <cstdlib>
  4. #include <stddef.h>
  5. void* operator new(size_t n)
  6. {
  7. // Overload global new and delete for memory inspection
  8. void* ptr = std::malloc(n);
  9. TracyAlloc(ptr, n);
  10. return ptr;
  11. }
  12. void operator delete(void* ptr) noexcept
  13. {
  14. TracyFree(ptr);
  15. std::free(ptr);
  16. }
  17. #endif