diff --git a/src/sdl/i_main.cpp b/src/sdl/i_main.cpp index e313d8c20..5577bf580 100644 --- a/src/sdl/i_main.cpp +++ b/src/sdl/i_main.cpp @@ -355,3 +355,16 @@ int main(int argc, char **argv) } #endif + +void* operator new(size_t count) +{ + auto p = malloc(count); + TracyAlloc(p, count); + return p; +} + +void operator delete(void* ptr) +{ + TracyFree(ptr); + free(ptr); +} diff --git a/src/z_zone.c b/src/z_zone.c index 59cceab06..95a2097e7 100644 --- a/src/z_zone.c +++ b/src/z_zone.c @@ -25,6 +25,8 @@ /// allocator was fragmenting badly. Finally, this version is a bit /// simpler (about half the lines of code). +#include + #include "doomdef.h" #include "doomstat.h" #include "r_patch.h" @@ -200,6 +202,7 @@ void Z_Free2(void *ptr, const char *file, INT32 line) *block->user = NULL; // Free the memory and get rid of the block. + TracyCFree(block->real); free(block->real); #ifdef VALGRIND_DESTROY_MEMPOOL VALGRIND_DESTROY_MEMPOOL(block); @@ -273,6 +276,7 @@ void *Z_Malloc2(size_t size, INT32 tag, void *user, INT32 alignbits, padsize += (1<