diff options
author | nastprol <nastprol@yandex-team.com> | 2024-09-25 20:02:27 +0300 |
---|---|---|
committer | nastprol <nastprol@yandex-team.com> | 2024-09-25 20:14:52 +0300 |
commit | e4a44c558f1c4081f70d159f2624866b4f0df9a2 (patch) | |
tree | 1d01afe6dd6445f7c56c8917707dccce1e352e63 | |
parent | e57557664329c3fe4b335c9ab95daad155d9e193 (diff) | |
download | ydb-e4a44c558f1c4081f70d159f2624866b4f0df9a2.tar.gz |
Add an option to disable refcounted tracking
commit_hash:ceb575c0377d4a48c0507590d878e690e92f5c63
-rw-r--r-- | library/cpp/yt/memory/chunked_memory_pool.cpp | 2 | ||||
-rw-r--r-- | library/cpp/yt/memory/ref.cpp | 6 | ||||
-rw-r--r-- | library/cpp/yt/misc/port.h | 8 |
3 files changed, 13 insertions, 3 deletions
diff --git a/library/cpp/yt/memory/chunked_memory_pool.cpp b/library/cpp/yt/memory/chunked_memory_pool.cpp index a10a6fe724..d8673f5d6c 100644 --- a/library/cpp/yt/memory/chunked_memory_pool.cpp +++ b/library/cpp/yt/memory/chunked_memory_pool.cpp @@ -15,6 +15,8 @@ TAllocationHolder::TAllocationHolder(TMutableRef ref, TRefCountedTypeCookie cook TRefCountedTrackerFacade::AllocateTagInstance(Cookie_); TRefCountedTrackerFacade::AllocateSpace(Cookie_, Ref_.Size()); } +#else + Y_UNUSED(cookie); #endif } diff --git a/library/cpp/yt/memory/ref.cpp b/library/cpp/yt/memory/ref.cpp index c01094846e..4d02ef6875 100644 --- a/library/cpp/yt/memory/ref.cpp +++ b/library/cpp/yt/memory/ref.cpp @@ -59,6 +59,8 @@ public: #ifdef YT_ENABLE_REF_COUNTED_TRACKING TRefCountedTrackerFacade::AllocateTagInstance(Cookie_); TRefCountedTrackerFacade::AllocateSpace(Cookie_, String_.length()); +#else + Y_UNUSED(cookie); #endif } ~TStringHolder() @@ -119,7 +121,11 @@ protected: TRefCountedTypeCookie cookie) { Size_ = size; +#ifdef YT_ENABLE_REF_COUNTED_TRACKING Cookie_ = cookie; +#else + Y_UNUSED(cookie); +#endif if (options.InitializeStorage) { ::memset(static_cast<TDerived*>(this)->GetBegin(), 0, Size_); } diff --git a/library/cpp/yt/misc/port.h b/library/cpp/yt/misc/port.h index fe1c5e96de..fd7df53855 100644 --- a/library/cpp/yt/misc/port.h +++ b/library/cpp/yt/misc/port.h @@ -7,9 +7,11 @@ #error YT requires 64-bit platform #endif -// This define enables tracking of reference-counted objects to provide -// various insightful information on memory usage and object creation patterns. -#define YT_ENABLE_REF_COUNTED_TRACKING +#ifndef YT_DISABLE_REF_COUNTED_TRACKING + // This define enables tracking of reference-counted objects to provide + // various insightful information on memory usage and object creation patterns. + #define YT_ENABLE_REF_COUNTED_TRACKING +#endif // This define enables logging with TRACE level. You can still disable trace logging // for particular TU by discarding this macro identifier. |