Skip to content

perf: tune mimalloc arena reservation and purge delay for lower RSS - #5488

Merged
oferchen merged 1 commit into
masterfrom
perf/mimalloc-arena-tuning
Jun 5, 2026
Merged

oferchen merged 1 commit into
masterfrom
perf/mimalloc-arena-tuning

Conversation

@oferchen

@oferchen oferchen commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • Reduce mimalloc's default virtual arena reservation from 1 GiB to 128 MiB via MIMALLOC_ARENA_RESERVE environment variable default
  • Set purge delay to 0 (immediate decommit) via MIMALLOC_PURGE_DELAY to release committed-but-purged pages promptly
  • RSS-2 profiling identified this as root cause Clamp peer protocol advertisements to supported range #5 of the 9.8x RSS gap vs upstream, contributing ~16 MiB overhead from mimalloc's committed-but-purged pages (committed=75.8 MiB, purged=70 MiB)
  • Defaults are set early in main() before any threads spawn; user-supplied MIMALLOC_* env vars take precedence

Test plan

  • CI passes (fmt, clippy, nextest, all platforms)
  • Verify with MIMALLOC_VERBOSE=1 that arena reservation reflects 128 MiB
  • Measure RSS on 1M-file corpus to confirm ~16 MiB reduction vs baseline
  • Verify user override: MIMALLOC_ARENA_RESERVE=1g oc-rsync ... restores original behavior

Reduce mimalloc's default 1 GiB virtual arena reservation to 128 MiB
and set purge delay to 0 (immediate decommit). RSS-2 profiling
identified the default arena reservation and deferred purge as root
cause #5 of the 9.8x RSS gap vs upstream, contributing ~16 MiB of
committed-but-purged page overhead.

Environment variable defaults are set early in main() and respect
user-supplied MIMALLOC_* overrides.
@oferchen
oferchen merged commit 0c1cfd2 into master Jun 5, 2026
67 checks passed
@oferchen
oferchen deleted the perf/mimalloc-arena-tuning branch June 5, 2026 19:28
oferchen added a commit that referenced this pull request Aug 24, 2026
…5488)

Reduce mimalloc's default 1 GiB virtual arena reservation to 128 MiB
and set purge delay to 0 (immediate decommit). RSS-2 profiling
identified the default arena reservation and deferred purge as root
cause #5 of the 9.8x RSS gap vs upstream, contributing ~16 MiB of
committed-but-purged page overhead.

Environment variable defaults are set early in main() and respect
user-supplied MIMALLOC_* overrides.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant