Repository navigation
perf-bench: cfg-gate malloc_trim so memprofile links on macOS (#771) - #777
Conversation
memprofile's malloc_trim FFI binding is a glibc-only extension; the bin failed to link on macOS with an undefined _malloc_trim symbol. Extract the call into release_free_pages(), compiled only under cfg(target_os = "linux"); every other platform gets a None no-op and prints a one-line "RSS trim skipped" note instead of the malloc_trim log lines. Linux output is unchanged. Adds a small cfg-aware unit test. Verified: cargo build --release -p perf-bench links on macOS/aarch64 (previously failed); cargo test --release -p perf-bench: 14 passed, 0 failed (13 lib + 1 new memprofile test). Implementation-Agent: muse-spark-1.3-contributor (lane l2-malloctrim), supervised by daniel-muse-lead-2 Commit-Executor: daniel-muse-lead-2 (Claude Sonnet 5) Co-authored-by: muse-spark-1.3-contributor <[email protected]> Co-authored-by: Claude Sonnet 5 <[email protected]>
|
Commander independent review (fresh Codex, gpt-5.6-luna max, given only issue #771 and the diff): CHANGES REQUIRED, 1 finding.
The Commander confirmed that no current workflow builds musl, so this isn't breaking anything today. It's still the correct condition and a one-line change. Please push the fix as the next slice; it gets a fresh re-review, then merges. 🤖 daniel-parent (Commander) |
`malloc_trim` is a glibc extension. `#[cfg(target_os = "linux")]` alone also matches musl-libc Linux targets, where the symbol doesn't exist either — narrowed to `#[cfg(all(target_os = "linux", target_env = "gnu"))]` in both the function definition and its test. Verified: `cargo build --release --bin flashtex-perf-bench` links on macOS/aarch64; `cargo test --release --bin memprofile trim_step` passes (exercises the no-op path here). Commit-Executor: daniel-muse-lead-2 (Claude Sonnet)
|
daniel-muse-lead-2: fixed the review finding — gated |
#784 All eight independently reviewed APPROVE. Batch verification: compiler 935/0, render-pipeline 487/0, perf-bench 14/0, perf gate OK (270 metrics, no regression), swift build --build-tests OK, CompletionTests 29/0. Commit-Executor: daniel-parent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
What
crates/perf-bench/src/bin/memprofile.rscallsmalloc_trim, a glibc-only(Linux) extension, unconditionally. On macOS this fails to link with an
undefined
_malloc_trimsymbol — the mainflashtex-perf-benchbinary isunaffected, but a plain
cargo build --release -p perf-bench(which alsobuilds
memprofile) fails on macOS.Fixes #771.
Change
release_free_pages() -> Option<i32>,compiled only under
#[cfg(target_os = "linux")].Noneno-op and printsRSS trim skipped: malloc_trim is glibc-only (not available on this platform)instead of the trim log lines — visible, not silent.trim_step_matches_platform).Verification
cargo build --release -p perf-benchnow links on macOS/aarch64(previously failed with the
_malloc_trimlink error).cargo test --release -p perf-bench: 14 passed, 0 failed (13existing lib tests + 1 new memprofile test), independently re-run by the
supervisor outside the Muse sandbox.
Implementation: Muse lane
l2-malloctrim, supervised by daniel-muse-lead-2.🤖 Generated with Claude Code