From 2cda54638b2795e8029c175bebfd90e2c85e140c Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Mon, 21 Oct 2024 16:50:48 -0700 Subject: [PATCH] Split out --enable-tracy-memory-tracking, disabled by default --- configure.ac | 8 ++++++++ src/main/main.cpp | 10 ++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 6ed6c5f153..1e21172d7c 100644 --- a/configure.ac +++ b/configure.ac @@ -359,6 +359,14 @@ if test x"$enable_tracy" = xyes; then fi AC_SUBST(tracy_CFLAGS) +AC_ARG_ENABLE(tracy-memory-tracking, + AS_HELP_STRING([--enable-tracy-memory-tracking], + [Enable 'tracy' profiler/tracer memory tracking code (slow)])) +AM_CONDITIONAL(USE_TRACY_MEMORY_TRACKING, [test x$enable_tracy_memory_tracking = xyes]) +if test x"$enable_tracy_memory_tracking" = xyes -a x"$enable_asan" = xyes; then + AC_MSG_ERROR([--enable-asan is not compatible with --enable-tracy-memory-tracking]) +fi + AC_ARG_ENABLE(tracy-gui, AS_HELP_STRING([--enable-tracy-gui], [Enable 'tracy' profiler/tracer server GUI])) diff --git a/src/main/main.cpp b/src/main/main.cpp index f2c771b122..edcd3ffb58 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -278,7 +278,7 @@ checkStellarCoreMajorVersionProtocolIdentity() } } -#ifdef USE_TRACY +#ifdef USE_TRACY_MEMORY_TRACKING #ifdef __has_feature #if __has_feature(address_sanitizer) @@ -290,7 +290,9 @@ checkStellarCoreMajorVersionProtocolIdentity() #endif #endif -#ifndef ASAN_ENABLED +#ifdef ASAN_ENABLED +#error "ASAN_ENABLED and USE_TRACY_MEMORY_TRACKING are mutually exclusive" +#else void* operator new(std::size_t count) { @@ -322,8 +324,8 @@ operator delete[](void* ptr) noexcept TracySecureFree(ptr); free(ptr); } -#endif // ASAN_ENABLED -#endif // USE_TRACY +#endif // !ASAN_ENABLED +#endif // USE_TRACY_MEMORY_TRACKING int main(int argc, char* const* argv)