summaryrefslogtreecommitdiffstats
path: root/source/core
diff options
context:
space:
mode:
Diffstat (limited to 'source/core')
-rw-r--r--source/core/slang-rtti-info.cpp10
-rw-r--r--source/core/slang-rtti-info.h5
2 files changed, 15 insertions, 0 deletions
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<std::recursive_mutex> guard(m_mutex);
return m_arena.allocate(size);
}
+ void deallocateAll()
+ {
+ std::lock_guard<std::recursive_mutex> 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)
diff --git a/source/core/slang-rtti-info.h b/source/core/slang-rtti-info.h
index 09a4bf657..36651c32b 100644
--- a/source/core/slang-rtti-info.h
+++ b/source/core/slang-rtti-info.h
@@ -109,6 +109,11 @@ struct RttiInfo
/// Is thread safe, and doesn't require the memory to be freed explicitly
/// Will be freed at shutdown (via global dtor)
static void* allocate(size_t size);
+ /// Will free up any allocations. Can only be called at shutdown, and there are guarenteed no uses of
+ /// RttiInfo - otherwise contents may be undefined.
+ /// NOTE! Memory *will* be freed with final dtors, but if memory check functions are used they can report
+ /// this memory.
+ static void deallocateAll();
static bool isIntegral(RttiInfo::Kind kind) { return Index(kind) >= Index(RttiInfo::Kind::I32) && Index(kind) <= Index(RttiInfo::Kind::U64); }
static bool isFloat(RttiInfo::Kind kind) { return kind == RttiInfo::Kind::F32 || kind == RttiInfo::Kind::F64; }