![]() |
GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
|
A static registry tracking the lifetime of C++ objects exposed to JavaScript via Emscripten/WebIDL bindings. More...
#include <MemoryTrackedRegistry.h>
Static Public Member Functions | |
| static void | add (const void *ptr, const char *className) |
| static void | remove (const void *ptr, const char *className) |
| static bool | isDead (const void *ptr, const char *className) |
| static void | add (long ptr, const gd::String &className) |
| static void | remove (long ptr, const gd::String &className) |
| static bool | isDead (long ptr, const gd::String &className) |
| static long | getDeadCount () |
| static void | pruneDead (long maxSize) |
| static long | getAliveCount () |
| static long | getAliveCountForClass (const gd::String &className) |
| static long | getDeadCountForClass (const gd::String &className) |
| static void | setCurrentCallContextId (long id) |
| static long | getDeadContextId (long ptr, const gd::String &className) |
| static double | getDeadContextTimeMs (long ptr, const gd::String &className) |
A static registry tracking the lifetime of C++ objects exposed to JavaScript via Emscripten/WebIDL bindings.
Uses two maps keyed by className, each mapping to a set of pointers:
Additionally stores a bounded ring buffer of destruction contexts per class, capturing which JS call triggered each destruction and when it happened.
This allows JavaScript wrappers to detect use-after-free by calling isDead(), and enables per-class statistics for debugging.
|
inlinestatic |
Returns the call-context ID that was active when the object was destroyed, or -1 if the context has been evicted from the ring buffer.
|
inlinestatic |
Returns the wall-clock timestamp (ms since Unix epoch) when the object was destroyed, or 0 if the context is not available.
|
inlinestatic |
Set by JS before each wrapped method call (integer ID, ~50-100ns).