GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
Static Public Member Functions | List of all members
gd::MemoryTrackedRegistry Class Reference

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)
 

Detailed Description

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:

This allows JavaScript wrappers to detect use-after-free by calling isDead(), and enables per-class statistics for debugging.


The documentation for this class was generated from the following file: