Skip to documentation
SLOP

tiny.memtrace

Reference tiny.memtrace

Overview · API · Code relationships · Verification · Audit

Overview

Memtrace records where a program's memory goes: which phase allocated it, from which call site, and how much of it is still live.

A recorder, the tracer, records each operation against the scope in force and answers with summaries and events. It wraps the allocator the caller hands it, the backing allocator, and forwards every operation to it. Wrapping one allocator at a time scopes the record to the subsystem the caller chose.

An enter call opens a named region of execution, the scope, which names the phase that later allocations are attributed to and closes when its span exits. A bounded table of labeled byte counts a caller reports by hand, the census, records memory beyond what the allocator names on its own.

A subsystem passes down a handle holding an optional tracer, an optional census, and an optional interval sink, the participation context. A disabled context leaves every call through it inert, so a subsystem keeps one code path whether an observer is present or absent.

When recording an allocation fails, rawAlloc frees the memory it obtained and answers null, which keeps live memory out of the program that the record does not mention. For a resize, a remap, or a free, a recording failure raises the tracer's failure flag and the memory operation stands, which leaves the capture partial. A tracer writes a summary of live and high-water bytes per scope, and a JSONL event stream, and its analysis reports capture integrity beside those totals so a partial capture is visible in the output.

Definitions

Types and contracts

Public types and contracts.

Namespaces

Public namespaces.

Values and defaults

Public values and defaults.

Code relationships

Direct static dependencies extracted from parsed source by semantic graph analysis.

Uses: tiny.bench, tiny.chant, tiny.hypothesis, tiny.sdfii, tiny.sys
Used by: tiny.bench, tiny.profiling

Verification

No verification records are cataloged for this module in this build.

Audit

EvidenceValue
Sourcelib/memtrace/src/root.zig
Definitions1 of 43 documented
Members0 of 0 documented
Public names43 API, 335 indexed
Version26.7.0
Revisiondaab053ee433