You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
deps: bump mimalloc to dev3 (bun-dev3-v2) (#29251)
Upgrades mimalloc to v3 via
[`oven-sh/mimalloc@bun-dev3-v2`](https://github.com/oven-sh/mimalloc/tree/bun-dev3-v2)
(2e94216f), which carries on top of upstream dev3:
- Thread-safety fixes for `mi_heap_delete` racing concurrent `mi_free`,
and `mi_heap_new` while another thread is in `mi_heap_destroy` (both
reproduce as assertion failures / ASAN UAF under load)
- Fix for the 1025th `mi_heap_new()` walking an uninitialized chunkmap →
OOB write
- `pthread_atfork`-based fork handling so children of multi-threaded
parents can allocate
- macOS fixed TLS slots moved 108/109→175/176 (avoid Swift runtime keys)
- Recursive `mi_thread_init` self-deadlock fix in
`_mi_os_get_aligned_hint`
Zig changes are a tighter subset of #26214:
- v1/v2 APIs removed from bindings: `mi_heap_{get,set}_default`,
`mi_heap_get_backing`, `mi_heap_check_owned`, `mi_heap_contains_block`.
Added `mi_heap_main`, `mi_heap_contains`.
- `MimallocArena` vtable split into `heap_allocator_vtable`
(per-`mi_heap_new` arena) + `global_mimalloc_vtable`
(`mi_malloc`/`mi_free` directly). `Default`/`getThreadLocalDefault`
route through global; no more cached per-thread heap pointer.
- Differs from #26214: `Borrowed.getDefault()` wraps `mi_heap_main()`
(not `undefined`) so `gc()`/`ownsPtr()` stay valid; `ownsPtr` uses
per-heap `mi_heap_contains` (not `mi_check_owned`); `downcast` only
accepts owned-heap vtable.
Build: `MI_NO_OPT_ARCH=ON`, Windows lib name dropped `-static` suffix.
Fixes#26762Closes#26214 - Also upgrades
mimalloc to v3; explicitly superseded by this PR
Closes#21875 - Earlier mimalloc v3
upgrade attempt
Closes#22043 - Earlier mimalloc v2
upgrade attempt
Closes#22894 - Another mimalloc
version bump
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
// On both architectures, we have one initializer "__GLOBAL__sub_I_static.c".
63
-
// On arm64, mimalloc v3 adds one more static initializer (total: 2).
64
-
// On x86_64, we also have:
65
-
// - one from ___cpu_indicator_init due to our CPU feature detection
66
-
// - one from mimalloc v3
67
-
// (total: 3)
62
+
// mimalloc v3 with MI_OSX_ZONE=ON contributes three: __GLOBAL__sub_I_static.c,
63
+
// mi_process_attach, and _mi_macos_override_malloc (the zone-swap constructor).
64
+
// On x86_64 there is also ___cpu_indicator_init from CPU feature detection.
68
65
expect(
69
66
bunInitializers.length,
70
67
`Do not add static initializers to Bun. Static initializers are called when Bun starts up, regardless of whether you use the variables or not. This makes Bun slower.`,
0 commit comments