Skip to content

Port stubbed mimalloc 3.5.x behavior into the Rust core - #1

Merged
tyler274 merged 1 commit into
main3from
rewrite/core-upstream-3.5-port
Nov 28, 2026
Merged

tyler274 merged 1 commit into
main3from
rewrite/core-upstream-3.5-port

Conversation

@tyler274

Copy link
Copy Markdown
Owner

Summary

  • collect_merges_stats at C enum index 47; rewrite-only quarantine/zero_on_free moved to 48/49. Heap collect merges stats only when set. Test reads include/mimalloc.h and checks every index (package.nix exports INCLUDE for the Nix build).
  • Delayed purge (purge_delay x arena_purge_mult) per empty cached page, cancelled on reuse; decommit vs reset (MADV_FREE / MEM_RESET) per purge_decommits.
  • Malloc pops the owner local_free list before thread_free.
  • allow_large_os_pages / mi_reserve_huge_os_pages*: MAP_HUGETLB (1 GiB, 2 MiB), MADV_HUGEPAGE, mbind; ENOMEM with no normal-page fallback, as in C.

Testing

Verified locally (Rust 1.99.1): cargo test -p elymalloc-core --release (117/117) and -p elymalloc-harness pass on this branch alone. c-abi, browsers, world (40/40), and the compiler oracle (0 rewrite-only failures) passed on the combined tree. Huge-page success path not exercised (host has nr_hugepages=0). Arena-wide purge bitmap and strict NUMA binding are follow-ups.

Match the C option enum (collect_merges_stats at index 47, rewrite-only
quarantine/zero_on_free after it) and honor it in heap stats merge.
Add delayed purge (purge_delay x arena_purge_mult) with the C
decommit-vs-reset split, pop owner local_free before thread_free, and
back allow_large_os_pages / mi_reserve_huge_os_pages* with MAP_HUGETLB,
MADV_HUGEPAGE and mbind instead of normal-page stubs.
@tyler274
tyler274 merged commit 3affc78 into main3 Nov 28, 2026
5 of 7 checks passed
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