chore(deps): update mimalloc to v2.5.2 and mimalloc3 to v3.5.2 + init fix - #104
Merged
Merged
Conversation
… fix v2: v2.5.1 -> v2.5.2 (official tag). v3: napi-rs fork 1e5d14ca (v3.5.1 + PR microsoft/mimalloc#1393) -> napi-rs fork afa6c90d (v3.5.2 + a one-line fix). Upstream took #1393 in a different form (439dc27b) and it is in v3.5.2, but that commit runs `mi_process_setup_auto_thread_done` before `_mi_process_is_initialized = true`. With `MI_TLS_RECURSE_GUARD` (what build.rs uses on macOS for v3) `_mi_theap_default()` still returns the empty theap there, so v3.5.2 aborts at process init in debug builds and skips the thread-done association in release builds. afa6c90d sets the flag first. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016srh5svTkqfW21zGcU6ht9
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_3d3890ae-67c0-4f8c-9c68-c873c1ecfb6e) |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Merged
Brooooooklyn
pushed a commit
that referenced
this pull request
Sep 14, 2026
## 🤖 New release * `libmimalloc-sys2`: 0.1.62 -> 0.1.63 (✓ API compatible changes) * `mimalloc-safe`: 0.1.66 -> 0.1.67 (✓ API compatible changes) <details><summary><i><b>Changelog</b></i></summary><p> ## `libmimalloc-sys2` <blockquote> ## [0.1.63] - 2026-09-14 ### Chore - *(deps)* Update mimalloc to v2.5.2 and mimalloc3 to v3.5.2 + init fix ([#104](#104)) </blockquote> ## `mimalloc-safe` <blockquote> ## [0.1.67] - 2026-09-14 ### Chore - *(deps)* Update mimalloc to v2.5.2 and mimalloc3 to v3.5.2 + init fix ([#104](#104)) - *(deps)* Update @napi-rs/cli and emnapi, group emnapi in renovate ([#106](#106)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Upstream closed microsoft/mimalloc#1393 and took the fix in a different form: microsoft/mimalloc@439dc27b, shipped in v3.5.2. That commit works on the default TLS model (verified with the #1393 repro on Linux, debug shared build:
e35400bdaborts,v3.5.2printsOK).But it moved
mi_process_setup_auto_thread_done()intomi_process_init_once()before_mi_process_is_initialized = true. WithMI_TLS_RECURSE_GUARD(auto-on forMI_TLS_MODEL_LOCALon Apple, which is whatbuild.rsforces for v3 on macOS)_mi_theap_default()returns_mi_theap_emptyat that point:So on plain
v3.5.2,cargo test --features v3on macOS aborts at process init in every debug binary:and release builds silently skip the association, i.e. the #1393 leak is back on macOS. Reproducible with upstream alone:
cmake -DCMAKE_BUILD_TYPE=Debug -DMI_TLS_MODEL=LOCALon macOS,./mimalloc-test-apipasses on v3.5.1 and aborts on v3.5.2. Same on Linux with-DMI_TLS_RECURSE_GUARD=ON.Changes
mimalloc(v2) —v2.5.1→v2.5.2(official tag, no patches).mimalloc3— napi-rs fork1e5d14ca(v3.5.1 + #1393) → napi-rs forkafa6c90d= upstream v3.5.2 + one-line fix: set_mi_process_is_initialized = truebeforemi_process_setup_auto_thread_done()(napi-rs/mimalloc@afa6c90d, branchfix/process-init-flag-before-thread-done). Same approach as fix(sys): use THREAD_LOCAL TLS for mimalloc v3 on Apple #71 / fix(sys): mimalloc3 v3.5.1 + fix for the process-init thread's thread-done hook #97..gitmodules—mimalloc3branch name updated.build.rsor the Rust sources.Verification
Upstream, macOS arm64, Debug,
-DMI_TLS_MODEL=LOCAL:mimalloc-test-apiafa6c90dUpstream, Linux x64 (Docker gcc:14), Debug shared, #1393 repro:
RECURSE_GUARD=OFFRECURSE_GUARD=ONafa6c90dThis repo, macOS arm64, every CI command:
cargo test/--features secure/extended/v3/extended,v3all pass;libmimalloc-sys-test258/258 (v2, secure, extended) and 251/251 (v3).Pre-existing and untouched: upstream
mimalloc-test-stress-heapsfails therefcount == 1assert withMI_TLS_MODEL=LOCALon macOS on v3.5.1 too;extended::tests::runtime_stable_optionfails undercargo test --workspaceon v2.5.1 too (not in CI).🤖 Generated with Claude Code
https://claude.ai/code/session_016srh5svTkqfW21zGcU6ht9
Note
Medium Risk
Changes which mimalloc v3 C sources are built, affecting process/thread allocator initialization on macOS and other TLS recurse-guard configurations.
Overview
Points the
mimalloc3git submodule at the napi-rs fork branchfix/process-init-flag-before-thread-doneinstead offix/first-thread-done, so v3 tracks upstream v3.5.2 plus a one-line init ordering fix: set_mi_process_is_initializedbeforemi_process_setup_auto_thread_done().That avoids macOS
MI_TLS_MODEL_LOCAL/ recurse-guard failures where v3.5.2 alone aborts in debug or reintroduces the #1393 leak in release. No Rust orbuild.rschanges in this diff—only the submodule branch pin in.gitmodules.Reviewed by Cursor Bugbot for commit 09fc0c6. Bugbot is set up for automated code reviews on this repo. Configure here.