Skip to content

Add allocation tracing for per-operation complexity checks #1118

Closed

Description

@ehartford

Phase 0 of docs/stdlib_sourcing_plan.md needs an executable check for #939: HashMap removal must not allocate while repairing a probe cluster.

The existing debug allocator reports surviving allocations and double frees. The temporary key/value buffers in with_hashmap_remove are freed before exit, so the leak report cannot detect this cost. WITH_DEBUG_ALLOC_TRAP_FREE filters one learned address; it cannot count all allocation requests in a marked operation. with_alloc_committed_bytes measures reserved pages rather than individual requests and is an internal runtime API, not a user-program benchmark interface.

Add an opt-in, runtime-gated allocation trace with a discoverable CLI flag and an environment equivalent. Emit one record per logical allocator request using the non-allocating debug output primitives. Keep it disabled by default and preserve the existing address trap. The complexity fixture can count records between stderr markers, with an empty-span control, without inventing a public stdlib allocation counter or a with_* extern in the benchmark.

Acceptance: the control span has zero allocations; a known allocating operation emits records; the existing clustered HashMap remove records its temporary allocations; off/on runs have the same program result; the trace works on each native runtime target. This support is being implemented with the Phase 0 lane.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions