allocation_counters.h¶
| File Path | engine/include/conjure/core/memory/allocation_counters.h |
| API ↗ | Memory |
Process-wide allocation counters.
Structs¶
| File | Description |
|---|---|
memory::allocation_counters |
The three cumulative counters. Relaxed atomics: readers only need eventual, monotonic values. |
memory::memory_snapshot |
A plain copy of the counters taken at one point in time. |
Functions¶
Public¶
memory::counters¶
memory::counters¶[[nodiscard]] CONJURE_API allocation_counters &counters() noexcept;The process-wide counters. Safe to call from any thread, including during static initialisation.
memory::record_allocation¶
memory::record_allocation¶CONJURE_API void record_allocation(usize bytes) noexcept;Records one allocation of bytes bytes. Called by tracked_allocate and by code that acquires memory through another route (global operator new in tests, physics allocation hooks).
memory::record_free¶
memory::record_free¶CONJURE_API void record_free() noexcept;Records one free. Counterpart of record_allocation.
memory::snapshot¶
memory::snapshot¶[[nodiscard]] CONJURE_API memory_snapshot snapshot() noexcept;Copies the current counter values. The three loads are not one atomic transaction; callers comparing snapshots quiesce other threads first (test fixtures) or accept small skews.