Skip to content

Phase 11.7: fix Rust stats tests missing #[global_allocator] install - #59

Merged
jayakasadev merged 1 commit into
mainfrom
feature/phase-11-7-stats-test-allocator-wiring
Jun 12, 2026
Merged

jayakasadev merged 1 commit into
mainfrom
feature/phase-11-7-stats-test-allocator-wiring

Conversation

@jayakasadev

Copy link
Copy Markdown
Owner

Summary

  • Install SnMalloc as the #[global_allocator] at the top of the four affected integration-test binaries (frontend_stats, full_stats, sizeclass_histogram, profile_lifetime_histogram) so the binary's allocations feed snmalloc's process-global counters instead of routing through the OS allocator and leaving the counters at zero.
  • Mirrors the pattern already in snmalloc-rs/benches/stats_bench.rs (Phase 11.1).
  • No test logic was changed -- only the allocator-install scaffolding.

ClickUp

  • 86aj0yehx

Test plan

  • cargo build --features stats succeeds
  • cargo test --features stats -- all previously-failing tests pass (fast_path_alloc_counter_grows, cross_thread_messages_grow, full_stats_bytes_in_use_grows_with_live_allocation, full_stats_backend_frag_invariants, cumulative_alloc_per_class_rises)
  • cargo test (no features) still passes
  • cargo test --features profiling --test profile_lifetime_histogram still passes

Notes

Coordinates with Phase 11.6 (tiered stats). If 11.6 changes the gating of SnMalloc::full_stats() from stats to stats-basic, the three #![cfg(feature = "stats")] test files (and their #[global_allocator] blocks, which sit under the same gate) will need a parallel update to #[cfg(any(feature = "stats", feature = "stats-basic"))].

The `frontend_stats`, `full_stats`, `sizeclass_histogram`, and
`profile_lifetime_histogram` integration tests rely on the test
binary's allocations feeding snmalloc's process-global counters.
Without `#[global_allocator] static ALLOC: SnMalloc = SnMalloc;`
at the top of each binary, the default cargo test runner routes
allocations through the OS allocator and the counters under test
stay at zero, causing intermittent panics such as
`fast_path_allocs delta (=0) must rise by at least 990`.

Mirrors the pattern already used by `snmalloc-rs/benches/stats_bench.rs`
(Phase 11.1).  No test logic was changed.

ClickUp: 86aj0yehx
@jayakasadev
jayakasadev merged commit b5b2180 into main Jun 12, 2026
18 of 211 checks passed
@jayakasadev
jayakasadev deleted the feature/phase-11-7-stats-test-allocator-wiring branch June 12, 2026 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant