Skip to content

Bump mimalloc: upstream v3.5.3 - #44575

Merged
Jarred-Sumner merged 1 commit into
mainfrom
claude/mimalloc-v3.5.3
Oct 4, 2026
Merged

Jarred-Sumner merged 1 commit into
mainfrom
claude/mimalloc-v3.5.3

Conversation

@Jarred-Sumner

@Jarred-Sumner Jarred-Sumner commented Oct 4, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

Bumps mimalloc to oven-sh/mimalloc#60, which merges upstream v3.5.3 into the fork (it was at v3.5.2).

  • Fixes a crash when the first mimalloc call on a new thread is mi_realloc(NULL, n), mi_reallocf, mi_strdup, mi_mallocn or mi_new, with a TLS model where the thread local heap of a new thread starts out as NULL (macOS and Windows).
  • Fixes mi_free_size_aligned of a small block with an alignment above its size. Bun's build (MI_FREE_USE_PAGEMAP=1) was not affected.
  • No function is removed from mimalloc.h, and no signature that src/mimalloc_sys binds changes.

The pin is the merge commit of that PR.

How did you verify your code works?

In the mimalloc PR: all tests in 11 configurations, a new test for the crash, and instruction counts for the allocation and free paths, which are the same before and after (52.5 per mi_malloc / mi_free with Bun's flags; start and exit 3190409 and 3190412). CI on the head of that PR (the same tree): the failures are the four test-docker-build-* tests (gpg cannot get the release key from a keyserver, which also fails on main and without Bun), two tests on the macOS 27 lane that also fail on main, and a sub-test of spawn.test.ts on the ASAN lane that was flaky on other branches before.

@Jarred-Sumner
Jarred-Sumner force-pushed the claude/mimalloc-v3.5.3 branch from f5892b6 to 5c67af5 Compare October 4, 2026 21:11
@Jarred-Sumner
Jarred-Sumner force-pushed the claude/mimalloc-v3.5.3 branch from 5c67af5 to 4c75aab Compare October 4, 2026 23:02
@Jarred-Sumner
Jarred-Sumner marked this pull request as ready for review October 4, 2026 23:03
@coderabbitai

coderabbitai Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: oven-sh/bun/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 71fd50e6-b963-4009-8003-7414049d3e14
📥 Commits

Reviewing files that changed from the base of the PR and between 1878660 and 4c75aab.

📒 Files selected for processing (1)
  • scripts/build/deps/mimalloc.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


Walkthrough

The mimalloc dependency now points to commit 92ef6587c57b262f6e6abf513f7776a2f8d12aeb. Its build configuration and behavior are unchanged.

Changes

Mimalloc dependency

Layer / File(s) Summary
Update mimalloc source pin
scripts/build/deps/mimalloc.ts
The mimalloc source commit pin changes. Build configuration and behavior remain unchanged.

Suggested reviewers: dylan-conway

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 4c75a

This updates the mimalloc source pin without changing build settings, and the inspected API declarations remain compatible. No actionable merge-blocking risk is identified.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: updating mimalloc to upstream v3.5.3.
Description check ✅ Passed The description includes both required sections. It explains the version bump, reported fixes, compatibility impact, and verification results, including known CI failures.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed this PR and didn't find any bugs. Because it re-pins Bun's process-wide allocator and the new upstream tree could not be inspected from this review environment, a human look (and green CI on every platform) is still worthwhile before merge.

What was reviewed:

  • The diff is the single MIMALLOC_COMMIT change in scripts/build/deps/mimalloc.ts; the old SHA appears nowhere else in the repo, the dep declares no patches, and the build spec (src/static.c unity TU, MI_* defines, TLS-model cflags) is untouched.
  • Bun's binding surface in src/mimalloc_sys/mimalloc.rs includes mi_free_size_aligned, mi_on_thread_idle_start, and mi_malloc_auto_align, so the upstream fix list and fork-only symbols are directly relied on; their signatures could not be re-checked against the new commit here.
  • Not verified: that the pinned SHA is the merged commit of oven-sh/mimalloc#60 on the fork's default branch rather than a branch head (no GitHub access from this run).
Extended reasoning...

The change is a one-line commit-pin bump for mimalloc in scripts/build/deps/mimalloc.ts, with no change to defines, sources, cflags, or patches, and no duplicate of the old SHA elsewhere in the repo. It touches no injection, auth, or data-exposure surface, but mimalloc is Bun's global malloc on Linux and the JS heap allocator on every platform, so an allocator regression would be process-wide. The review could not reach GitHub to confirm the SHA is the merged oven-sh/mimalloc#60 merge commit or to diff the upstream change against Bun's FFI bindings, and no local vendor checkout exists to compile from, so behavior preservation rests on CI rather than on anything verified here, which is why this is a defer rather than an approve.

@Jarred-Sumner
Jarred-Sumner merged commit 9c3439a into main Oct 4, 2026
9 of 10 checks passed
@Jarred-Sumner
Jarred-Sumner deleted the claude/mimalloc-v3.5.3 branch October 4, 2026 23:32
Shrub24 pushed a commit to Shrub24/Pi-Bolt that referenced this pull request Oct 17, 2026
Bun (cherry-picked onto the pinned commit, before Pi-Bolt's patch):
- startup SIGILL on Linux arm64 when SVE2 is reported without SVE (oven-sh/bun#45099)
- fetch sets up TLS once per connection (oven-sh/bun#44507)
- stdout/stderr: O_NONBLOCK cleared for spawned children, no output dropped on EAGAIN (oven-sh/bun#43868)
- a socket whose peer keeps the receive buffer full no longer stops timers (oven-sh/bun#45278)
- PipeReader after a failed read (oven-sh/bun#43900), spawnSync (oven-sh/bun#44581)
- TextEncoder.encode of a substring (oven-sh/bun#45281)
- fetch over HTTP/2 after a TLS alert or an abort (oven-sh/bun#45422)
- mimalloc 3.5.3 (oven-sh/bun#44560, oven-sh/bun#44575)

WebKit (appended to the patch series):
- a module removed while its import() is in flight (oven-sh/WebKit#748)
- cgroup v2 limits beside a cgroup v1 hierarchy (oven-sh/WebKit#808)

Test-file conflicts were resolved to the pinned tests; the source changes are as upstream.
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