TracyAlloc.hpp 600 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef __TRACYALLOC_HPP__
  2. #define __TRACYALLOC_HPP__
  3. #include <stdlib.h>
  4. #ifdef TRACY_ENABLE
  5. # include "../client/tracy_rpmalloc.hpp"
  6. #endif
  7. namespace tracy
  8. {
  9. static inline void* tracy_malloc( size_t size )
  10. {
  11. #ifdef TRACY_ENABLE
  12. return rpmalloc( size );
  13. #else
  14. return malloc( size );
  15. #endif
  16. }
  17. static inline void tracy_free( void* ptr )
  18. {
  19. #ifdef TRACY_ENABLE
  20. rpfree( ptr );
  21. #else
  22. free( ptr );
  23. #endif
  24. }
  25. static inline void* tracy_realloc( void* ptr, size_t size )
  26. {
  27. #ifdef TRACY_ENABLE
  28. return rprealloc( ptr, size );
  29. #else
  30. return realloc( ptr, size );
  31. #endif
  32. }
  33. }
  34. #endif