emscripten-core / emscripten

Emscripten: An LLVM-to-WebAssembly Compiler
Other
25.91k stars 3.32k forks source link

Update mimalloc to microsoft/mimalloc@9b75377 #23027

Closed kleisauke closed 4 days ago

kleisauke commented 6 days ago

Context: this PR seems to address a suspicious(?) OOM error on wasm-vips' test suite. See for example the CI results for commit https://github.com/kleisauke/wasm-vips/commit/605b53fc7d925507eabb668bbcb9627f325d5a64 and https://github.com/kleisauke/wasm-vips/commit/5cb048be333d5ccf65587e9f0c51c571f8055364. https://github.com/kleisauke/wasm-vips/actions/runs/12053482829/job/33610497071#step:7:302 https://github.com/kleisauke/wasm-vips/actions/runs/12053529699

It's generally recommended to use tagged upstream versions, but I prefer to avoid those that are known to have issues. Note that the previous version of mimalloc (used prior to PR #21548) was commit https://github.com/microsoft/mimalloc/commit/4e50d6714d471b72b2285e25a3df6c92db944593, which is also an untagged version.

kleisauke commented 4 days ago

Updating to the latest commit on the dev-slice branch did not resolve the issue (see https://github.com/kleisauke/wasm-vips/commit/28b407a1fc10f80f15c93a948cfacd97508c140a and https://github.com/emscripten-core/emscripten/compare/HEAD...kleisauke:mimalloc-update-577246d for details).

Upon further investigation, it appears to be the same issue as outlined in https://github.com/emscripten-core/emscripten/issues/20645#issuecomment-1962964755, i.e. mimalloc requests an alignment of 4 MiB, causing emmalloc to allocate 8 MiB (or perhaps was that fixed via 3cd6861ccdf02a89555b94d6ab5397efb1b0ede8?), which somehow exceeds the -sINITIAL_MEMORY=1GB limit in wasm-vips' test suite. Halving the page size seems to fix this.

Closing in favor of #23037.