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.cr

Class Method Summary

Class Method Detail

def self.clear! : Void #

Clears all tracked allocations (useful for test isolation)


def self.dump_leaks(io : IO = STDERR) : Int32 #

Dumps a formatted leak summary report to the specified IO


def self.enabled=(enabled : Bool) #

def self.enabled? : Bool #

def self.live_allocations : Array(AllocationInfo) #

Returns all currently tracked allocations


def self.live_count : Int32 #

Returns the count of currently live tracked objects


def self.register(instance_id : UInt64, class_name : String, file : String, line : Int32) : Void #

Registers a newly allocated Godot object instance


def self.unregister(instance_id : UInt64) : Void #

Unregisters a destroyed or freed object instance