class Runtime
class Runtime
lib/runtime.tya:2
Runtime provides the runtime/Runtime standard library API.
Source
# Runtime provides the runtime/Runtime standard library API.
class Runtime
# Triggers a full mark-and-sweep collection. The collector treats
# module-level globals as roots, plus the active raise-frame chain.
# Locals inside user functions are NOT roots, so this must only be
# called at points where every live local TyaValue is also reachable
# from a registered root (in practice: at the top level of the
# program, between top-level statements). See docs/v0.41/SPEC.md for
# the full safety contract and known limitations.
# @return Any the resulting value.
gc: -> runtime_gc_collect()
# Returns a snapshot of the current GC counters as a dict with the
# following keys:
#
# alloc_count total tracked allocations made since program start
# alloc_bytes total tracked allocation bytes since program start
# freed_count total tracked allocations reclaimed by collections
# freed_bytes total tracked allocation bytes reclaimed
# live_count alloc_count - freed_count
# live_bytes alloc_bytes - freed_bytes
# collect_count number of collections performed
# threshold live_count threshold that triggers a collection
# @return Any the resulting value.
gc_stats: -> runtime_gc_stats()
Methods
gc
Runtime.gc()
lib/runtime.tya:11
Triggers a full mark-and-sweep collection. The collector treats module-level globals as roots, plus the active raise-frame chain. Locals inside user functions are NOT roots, so this must only be called at points where every live local TyaValue is also reachable from a registered root (in practice: at the top level of the program, between top-level statements). See docs/v0.41/SPEC.md for the full safety contract and known limitations.
Source
# Triggers a full mark-and-sweep collection. The collector treats
# module-level globals as roots, plus the active raise-frame chain.
# Locals inside user functions are NOT roots, so this must only be
# called at points where every live local TyaValue is also reachable
# from a registered root (in practice: at the top level of the
# program, between top-level statements). See docs/v0.41/SPEC.md for
# the full safety contract and known limitations.
# @return Any the resulting value.
gc: -> runtime_gc_collect()
gc_stats
Runtime.gc_stats()
lib/runtime.tya:25
Returns a snapshot of the current GC counters as a dict with the following keys:
alloc_count total tracked allocations made since program start alloc_bytes total tracked allocation bytes since program start freed_count total tracked allocations reclaimed by collections freed_bytes total tracked allocation bytes reclaimed live_count alloc_count - freed_count live_bytes alloc_bytes - freed_bytes collect_count number of collections performed threshold live_count threshold that triggers a collection
Source
# Returns a snapshot of the current GC counters as a dict with the
# following keys:
#
# alloc_count total tracked allocations made since program start
# alloc_bytes total tracked allocation bytes since program start
# freed_count total tracked allocations reclaimed by collections
# freed_bytes total tracked allocation bytes reclaimed
# live_count alloc_count - freed_count
# live_bytes alloc_bytes - freed_bytes
# collect_count number of collections performed
# threshold live_count threshold that triggers a collection
# @return Any the resulting value.
gc_stats: -> runtime_gc_stats()