From 233635c9324ca2ed3ca6ba1231ac5c73facb9fb2 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 24 Nov 2021 17:07:22 -0500 Subject: Fix for slang-test memory leak (#2029) * #include an absolute path didn't work - because paths were taken to always be relative. * Fix memory leak due to Rtti usage. --- source/core/slang-rtti-info.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source/core/slang-rtti-info.cpp') diff --git a/source/core/slang-rtti-info.cpp b/source/core/slang-rtti-info.cpp index f53cf742f..043e6490a 100644 --- a/source/core/slang-rtti-info.cpp +++ b/source/core/slang-rtti-info.cpp @@ -39,6 +39,11 @@ struct RttiInfoManager std::lock_guard guard(m_mutex); return m_arena.allocate(size); } + void deallocateAll() + { + std::lock_guard guard(m_mutex); + m_arena.reset(); + } static RttiInfoManager& getSingleton() { @@ -61,6 +66,11 @@ protected: return RttiInfoManager::getSingleton().allocate(size); } +/* static */void RttiInfo::deallocateAll() +{ + return RttiInfoManager::getSingleton().deallocateAll(); +} + /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! StructRttiBuilder !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ static void _appendFixedArray(const FixedArrayRttiInfo* inFixedArray, StringBuilder& out) -- cgit v1.2.3