module
Godot::LeakTracker
Overview
LeakTracker: Tracks all active Crystal Godot object instances for leak detection.
Enabled via -Dleak_tracker or -Dtrace_allocations (or --leak-tracker in Lapis CLI).
When active, records allocation metadata (class name, source location, timestamp) upon object initialization, and unregisters upon object deallocation.
At program exit, if any objects remain uncollected, prints a formatted report showing the exact allocation callsite for every leaked object.
Defined in:
libgodot/diagnostics/leak_tracker.crClass Method Summary
-
.clear! : Void
Clears all tracked allocations (useful for test isolation)
-
.dump_leaks(io : IO = STDERR) : Int32
Dumps a formatted leak summary report to the specified IO
- .enabled=(enabled : Bool)
- .enabled? : Bool
-
.live_allocations : Array(AllocationInfo)
Returns all currently tracked allocations
-
.live_count : Int32
Returns the count of currently live tracked objects
-
.register(instance_id : UInt64, class_name : String, file : String, line : Int32) : Void
Registers a newly allocated Godot object instance
-
.unregister(instance_id : UInt64) : Void
Unregisters a destroyed or freed object instance
Class Method Detail
Dumps a formatted leak summary report to the specified IO
Registers a newly allocated Godot object instance