Files
cpp-project-template/third_party/tracy/public/common/TracyAlloc.hpp
tqcq 68b2e7f763
Some checks failed
sm-rpc / build (Debug, arm-linux-gnueabihf) (push) Successful in 1m34s
sm-rpc / build (Debug, aarch64-linux-gnu) (push) Successful in 2m46s
sm-rpc / build (Debug, host.gcc) (push) Failing after 1m28s
sm-rpc / build (Release, aarch64-linux-gnu) (push) Successful in 2m14s
sm-rpc / build (Release, arm-linux-gnueabihf) (push) Successful in 2m8s
sm-rpc / build (Debug, mipsel-linux-gnu) (push) Successful in 5m35s
sm-rpc / build (Release, host.gcc) (push) Failing after 1m55s
sm-rpc / build (Release, mipsel-linux-gnu) (push) Successful in 7m21s
fix: breakpad use miniz
2025-08-25 15:24:22 +08:00

73 lines
1.2 KiB
C++

#ifndef __TRACYALLOC_HPP__
#define __TRACYALLOC_HPP__
#include <stdlib.h>
#if defined TRACY_ENABLE && !defined __EMSCRIPTEN__
# include "TracyApi.h"
# include "TracyForceInline.hpp"
# include "../client/tracy_rpmalloc.hpp"
# define TRACY_USE_RPMALLOC
#endif
namespace tracy
{
#ifdef TRACY_USE_RPMALLOC
TRACY_API void InitRpmalloc();
#else
static inline void InitRpmalloc() {}
#endif
static inline void* tracy_malloc( size_t size )
{
#ifdef TRACY_USE_RPMALLOC
InitRpmalloc();
return rpmalloc( size );
#else
return malloc( size );
#endif
}
static inline void* tracy_malloc_fast( size_t size )
{
#ifdef TRACY_USE_RPMALLOC
return rpmalloc( size );
#else
return malloc( size );
#endif
}
static inline void tracy_free( void* ptr )
{
#ifdef TRACY_USE_RPMALLOC
InitRpmalloc();
rpfree( ptr );
#else
free( ptr );
#endif
}
static inline void tracy_free_fast( void* ptr )
{
#ifdef TRACY_USE_RPMALLOC
rpfree( ptr );
#else
free( ptr );
#endif
}
static inline void* tracy_realloc( void* ptr, size_t size )
{
#ifdef TRACY_USE_RPMALLOC
InitRpmalloc();
return rprealloc( ptr, size );
#else
return realloc( ptr, size );
#endif
}
}
#endif