just_memory library

Memory-management primitives for games and other real-time Dart code.

Classes

ArenaStats
The occupancy of one MemoryArena, as reported by PoolManager.getArenaStats.
BudgetedCache<K, V>
A least-recently-used cache bounded by total cost rather than entry count.
CacheBudgetStats
The size and budget of one BudgetedCache at one moment.
LeakTracker
Counts objects that were created but never disposed, by label.
MemoryArena
Fixed-size, contiguous numeric storage for entity-like state.
MemoryCleanupResult
What a MemoryProfiler cleanup touched.
MemoryProfiler
Watches named pools and caches and captures their counters on demand.
MemoryProfileSnapshot
The counters of a MemoryProfiler's pools and caches at one moment.
MemoryScope
Groups cleanup steps that share one lifetime (a scene, a subsystem) and runs them together, last registered first.
MemoryStats
The counters of one ObjectPool at one moment.
ObjectPool<T>
A pool that hands out reusable objects of type T and takes them back.
PoolManager
A process-wide registry of named ObjectPools, MemoryArenas and RoundRobinPools, so systems can share them by name.
PoolStats
The counts of one ObjectPool, as reported by PoolManager.getPoolStats.
PriorityPool<T>
A pool that, when empty, can take back its lowest-priority object.
Recyclable
Interface for objects that can clear their mutable state before reuse.
RefCountedRegistry<K, V>
Shares loaded values between holders and frees each one after its last holder lets go.
ResourceHandle<K, V>
One reference to a value held by a RefCountedRegistry.
RoundRobinPool<T>
A fixed ring of objects handed out in turn.
SystemMemorySnapshot
The host's memory figures at one moment, as read by MemoryProfiler.captureSystemMemory.
TypedBuffer<T extends num>
A fixed-capacity numeric buffer backed by a Float64List, Float32List or Int32List.
TypedTransform
A view of one MemoryArena slot as a 2D transform (position, rotation, scale, velocity), using the arena's transform layout.
TypedVec2
A 2D vector stored in two components of a MemoryArena slot, or in its own fields when made with TypedVec2.temp.

Typedefs

CostEstimator<K, V> = int Function(K key, V value)
Returns what an entry costs against a BudgetedCache's budget (bytes, pixels, or any unit). Must not be negative.
DisposeCallback = FutureOr<void> Function()
A cleanup step owned by a MemoryScope; may be asynchronous.
EvictionCallback<K, V> = void Function(K key, V value)
Called with an entry that has left a BudgetedCache.
ResourceDisposer<V> = FutureOr<void> Function(V value)
Frees a value once nothing holds it any more.
ResourceLoader<K, V> = FutureOr<V> Function(K key)
Loads the value for key; may be synchronous or asynchronous.