chore(deps): switch mimalloc3 to upstream microsoft/mimalloc#82
Draft
shulaoda wants to merge 1 commit into
Draft
chore(deps): switch mimalloc3 to upstream microsoft/mimalloc#82shulaoda wants to merge 1 commit into
shulaoda wants to merge 1 commit into
Conversation
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
On macOS, mimalloc v3 stores the per-thread heap pointer in a fixed TLS slot (TCB
[108]/[109]) shared by every image, so a second statically-linked copy (e.g. another napi addon) adopts the first's heap and crashes. We worked around this with a vendoredprim.hpatch in thenapi-rs/mimallocfork. Upstream now fixes it in microsoft/mimalloc#1301 (b83dee64) by exposing cmake options, so we can drop the fork.Changes
.gitmodules—mimalloc3urlnapi-rs/mimalloc→microsoft/mimalloc.mimalloc3—5853e09(fork) →b83dee64(officialdev3); drops the vendoredprim.hpatch.build.rs— on v3 + macOS, enable the official options:mimalloc(v2) — routine bump02a2f5d→fef6b0d.Notes
target_os == "ios"to cover iOS/tvOS.MI_TLS_RECURSE_GUARDis belt-and-suspenders — upstreamprim.halready auto-enables it on Apple; we set it explicitly for clarity.MI_THREADID_INVALIDpoison inmi_tld_freeis present inb83dee64.Verification (macOS)
CMakeCacheMI_TLS_MODEL_LOCAL:BOOL=ON/MI_TLS_RECURSE_GUARD:BOOL=ON; compiled withMI_TLS_MODEL_THREAD_LOCAL=1+MI_TLS_RECURSE_GUARD=1.cargo test --features v3:mimalloc-safe6/6 pass;libmimalloc-sys-testruns.