8 #include "tracy/TracyC.h"
10 #pragma GCC diagnostic push
11 #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
13 static inline void* tracy_malloc(
size_t size)
18 TracyCAlloc(ptr, size);
23 static inline void* tracy_calloc(
size_t num,
size_t size)
26 ptr = calloc(num, size);
28 TracyCAlloc(ptr, num * size);
33 static inline void* tracy_realloc(
void* ptr,
size_t size)
39 new_ptr = realloc(ptr, size);
41 TracyCAlloc(new_ptr, size);
46 static inline void tracy_free(
void* ptr)
54 static inline char* tracy_strdup(
const char* str)
59 TracyCAlloc(ptr, strlen(ptr) + 1);
64 static inline int tracy_posix_memalign(
void** memptr,
size_t alignment,
67 int res = posix_memalign(memptr, alignment, size);
68 if (res == 0 && *memptr) {
69 TracyCAlloc(*memptr, size);
74 static inline void* tracy_aligned_alloc(
size_t alignment,
size_t size)
77 ptr = aligned_alloc(alignment, size);
79 TracyCAlloc(ptr, size);
84 #define malloc(x) tracy_malloc(x)
85 #define calloc(x, y) tracy_calloc(x, y)
86 #define realloc(x, y) tracy_realloc(x, y)
87 #define free(x) tracy_free(x)
88 #define strdup(x) tracy_strdup(x)
89 #define posix_memalign(x, y, z) tracy_posix_memalign(x, y, z)
90 #define aligned_alloc(x, y) tracy_aligned_alloc(x, y)
92 #pragma GCC diagnostic pop