aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/ytalloc/impl
diff options
context:
space:
mode:
authorbabenko <babenko@yandex-team.com>2023-05-19 12:58:03 +0300
committerbabenko <babenko@yandex-team.com>2023-05-19 12:58:03 +0300
commit62539a50bcf9bb30844426ccfa6a49ee08bfb3fe (patch)
treeda3a0d539c0dc4b6563f156ac7e9685066ac07fa /library/cpp/ytalloc/impl
parent8d9a38ae2a2758b5031dcc6c11efba25ed7cf5ea (diff)
downloadydb-62539a50bcf9bb30844426ccfa6a49ee08bfb3fe.tar.gz
Extract memory tag API to library
Diffstat (limited to 'library/cpp/ytalloc/impl')
-rw-r--r--library/cpp/ytalloc/impl/bridge.cpp18
-rw-r--r--library/cpp/ytalloc/impl/core-inl.h2
2 files changed, 19 insertions, 1 deletions
diff --git a/library/cpp/ytalloc/impl/bridge.cpp b/library/cpp/ytalloc/impl/bridge.cpp
index c8287d80de..5444a8d48b 100644
--- a/library/cpp/ytalloc/impl/bridge.cpp
+++ b/library/cpp/ytalloc/impl/bridge.cpp
@@ -4,6 +4,8 @@
#include <library/cpp/malloc/api/malloc.h>
+#include <library/cpp/yt/memory/memory_tag.h>
+
namespace NYT::NYTAlloc {
////////////////////////////////////////////////////////////////////////////////
@@ -49,11 +51,19 @@ size_t GetAllocationSize(size_t size)
#endif
////////////////////////////////////////////////////////////////////////////////
+
+} // namespace NYT::NYTAlloc
+
+namespace NYT {
+
+using namespace NYTAlloc;
+
+////////////////////////////////////////////////////////////////////////////////
// Memory tags API bridge
TMemoryTag GetCurrentMemoryTag()
{
- return TThreadManager::GetCurrentMemoryTag();
+ return NYTAlloc::TThreadManager::GetCurrentMemoryTag();
}
void SetCurrentMemoryTag(TMemoryTag tag)
@@ -75,6 +85,12 @@ size_t GetMemoryUsageForTag(TMemoryTag tag)
}
////////////////////////////////////////////////////////////////////////////////
+
+} // namespace NYT
+
+namespace NYT::NYTAlloc {
+
+////////////////////////////////////////////////////////////////////////////////
// Memory zone API bridge
void SetCurrentMemoryZone(EMemoryZone zone)
diff --git a/library/cpp/ytalloc/impl/core-inl.h b/library/cpp/ytalloc/impl/core-inl.h
index e8e5d25442..babf58aaa8 100644
--- a/library/cpp/ytalloc/impl/core-inl.h
+++ b/library/cpp/ytalloc/impl/core-inl.h
@@ -7,6 +7,8 @@
#include <library/cpp/yt/containers/intrusive_linked_list.h>
+#include <library/cpp/yt/memory/memory_tag.h>
+
#include <library/cpp/yt/threading/at_fork.h>
#include <library/cpp/yt/threading/fork_aware_spin_lock.h>