summaryrefslogtreecommitdiff
path: root/source/core/slang-rtti-info.h
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2021-11-24 17:07:22 -0500
committerGitHub <noreply@github.com>2021-11-24 17:07:22 -0500
commit233635c9324ca2ed3ca6ba1231ac5c73facb9fb2 (patch)
tree746d265e26200d777d3307293df97718e870258d /source/core/slang-rtti-info.h
parent7db340b75e7bf31e5a1e3ac1a3b4c651c6087f92 (diff)
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.
Diffstat (limited to 'source/core/slang-rtti-info.h')
-rw-r--r--source/core/slang-rtti-info.h5
1 files changed, 5 insertions, 0 deletions
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; }