Expand description
Provides a public interface for querying engine-wide memory allocation statistics.
This module defines a set of global atomic counters for detailed memory tracking. It forms a “contract” where a registered global allocator is responsible for incrementing these counters, and any part of the engine can read them in a thread-safe manner to monitor memory usage.
The primary use case is for the khora-telemetry
crate to collect these stats
and feed them into the Dynamic Context Core (DCC) for adaptive decision-making.
Structs§
- Extended
Memory Stats - A snapshot of comprehensive memory allocation statistics, including derived metrics.
Statics§
- BYTES_
ALLOCATED_ LIFETIME - Tracks the cumulative total of bytes ever allocated over the application’s lifetime.
- BYTES_
DEALLOCATED_ LIFETIME - Tracks the cumulative total of bytes ever deallocated over the application’s lifetime.
- CURRENTLY_
ALLOCATED_ BYTES - Tracks the total number of bytes currently allocated by the registered global allocator.
- LARGE_
ALLOCATIONS - Tracks the number of “large” allocations (e.g., >= 1MB).
- LARGE_
ALLOCATION_ BYTES - Tracks the cumulative total of bytes from “large” allocations.
- PEAK_
ALLOCATED_ BYTES - Tracks the peak number of bytes ever allocated simultaneously during the application’s lifetime.
- SMALL_
ALLOCATIONS - Tracks the number of “small” allocations (e.g., < 1KB).
- SMALL_
ALLOCATION_ BYTES - Tracks the cumulative total of bytes from “small” allocations.
- TOTAL_
ALLOCATIONS - Tracks the total number of allocation calls made.
- TOTAL_
DEALLOCATIONS - Tracks the total number of deallocation calls made.
- TOTAL_
REALLOCATIONS - Tracks the total number of reallocation calls made.
Functions§
- get_
currently_ allocated_ bytes - Gets the total number of bytes currently allocated by the global allocator.
- get_
extended_ memory_ stats - Takes a snapshot of all global memory counters and returns them in a structured format.