Skip to content

fix(diagnostics): report OS-truth RSS, not mimalloc's Linux commit counter - #1516

Merged
DeusData merged 1 commit into
mainfrom
fix/diagnostics-os-rss
Aug 10, 2026
Merged

DeusData merged 1 commit into
mainfrom
fix/diagnostics-os-rss

Conversation

@DeusData

Copy link
Copy Markdown
Owner

Both Linux soak-quick legs in dry run 31364739675 failed with FAIL: RSS 17592186044293MB > 200MB ceiling — that value is 2^44−123, i.e. −123 MB wrapped through size_t, not a leak.

The diagnostics snapshot reported mi_process_info() current_rss verbatim. On Linux mimalloc never sets that field; it keeps mimalloc-internal committed-page accounting, which this project deliberately tunes low (purge_decommits=1, purge_delay=0) and which can transiently go negative under purge. macOS/Windows are unaffected (mimalloc reports real RSS there) — matching the observed split exactly: both Linux legs red, both macOS legs green, same binary.

mem.c already encodes the full lesson for cbm_mem_over_budget (documented in its comment block): cbm_mem_rss() is /proc/self/statm-primary on Linux and mimalloc-correct elsewhere; cbm_mem_peak_rss() reconciles peak ≥ current. The diagnostics writer now uses both.

Verified: diagnostics suite passes locally; compiles + clang-format clean. Dry run re-dispatch follows the merge.

…unter

Both Linux soak-quick legs in the dry run failed with:

  FAIL: RSS 17592186044293MB > 200MB ceiling

17592186044293 MB is 2^44-123 -- a NEGATIVE ~123MB wrapped through size_t. The
diagnostics snapshot reported mi_process_info()'s current_rss verbatim, and on
Linux mimalloc never sets that field: it keeps mimalloc's internal
committed-page counter, which this project deliberately tunes low
(purge_decommits=1, purge_delay=0) and which can transiently go negative under
purge. macOS and Windows are untouched -- mimalloc reports real RSS there --
which is exactly the observed split: both Linux legs red, both macOS legs green.

mem.c already learned this lesson in full (its comment block documents the same
trap for cbm_mem_over_budget): cbm_mem_rss() is /proc-statm-primary on Linux and
mimalloc-correct elsewhere, and cbm_mem_peak_rss() reconciles peak >= current.
The diagnostics writer now uses both instead of the raw mi fields, so the soak
leak gates measure actual process RSS on every platform.

Verified: diagnostics suite passes; compiles and formats clean.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
@DeusData
DeusData merged commit aa6d740 into main Aug 10, 2026
13 checks passed
@DeusData
DeusData deleted the fix/diagnostics-os-rss branch August 10, 2026 09:19
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