StaticcapacityGet the current capacity of the root stack.
StaticisCheck if GCManager is initialized.
StaticisCheck if perf mode GC is initialized.
StaticperfGet the perf stack capacity.
StaticperfGet the current perf stack size.
StaticsizeGet the number of protected objects.
StaticcloseInternalClean up the GC manager. Called by Julia.close().
StaticgetGet the value at a specific index (for debugging).
The index to read
The pointer at that index
StaticgetGet the scope ID of a value at the given index.
The index to query
The scope ID (0 for global scope or unassigned)
StaticinitInternalInitialize the GC manager. Called by Julia.init() after Julia is fully initialized.
StaticperfInitialize the performance mode GC stack. Only call this if you plan to use perf mode scopes.
Initial capacity (default 1024)
StaticperfGet the current perf stack position (mark point). Use this before pushing values, then release to this mark.
Current stack position
StaticperfPush a Julia value onto the perf stack. The value will be protected until perfRelease() is called.
The Julia value to protect
The index where the value was stored
StaticperfRelease all values from mark position to current top. This is O(1) amortized - just resets the stack pointer and clears the slots.
The mark position to release to
StaticpushPush a Julia value with explicit scope ownership. The value will be protected until scopeEnd(scopeId) is called.
The Julia value to protect
The scope this value belongs to
The index in the stack where the value was stored
StaticregisterRegister an escaped value with FinalizationRegistry. When the JS object is garbage collected, the Julia root slot will be cleared.
The Julia value to register
The index in the GC stack where the value is stored
StaticscopeBegin a new scope and get a unique scope ID. Values pushed with this scope_id will be released together when scopeEnd is called.
This is the recommended API for async scopes that may run concurrently.
A unique scope ID (never 0, which is reserved for global scope)
StaticscopeEnd a scope and release all values belonging to it. This is safe to call even if other scopes are still active.
The scope to release
StaticsetSet a value at a specific index. Used internally for clearing slots.
The index to write
The value to store
StatictransferTransfer a value to a different scope (for escape). The value will now be released when the new scope ends.
The index of the value to transfer
The new scope to transfer to (use 0n for global/permanent)
The same index, or -1 on error
StaticunregisterUnregister an escaped value from FinalizationRegistry. Call this if you manually release the value.
The Julia value to unregister
Scope-based GC Manager for automatic lifecycle management of Julia objects.
This module provides efficient garbage collection integration between JavaScript and Julia runtimes using scope-based isolation.
Design:
API: