Skip to content

Safari + Unaligned Load + Asyncify = Page memory leak #26027

@jamesdolan

Description

@jamesdolan

This is likely a Safari bug, but because it only triggers when using certain arguments to Emscripten I am cross posting here. Basically under certain circumstances, when WASM performs an unaligned load, and Asyncify is enabled, and you are using Safari, it triggers a continuous memory leak even after all WASM threads have completed eventually causing an out-of-memory crash. There are a few libraries I have encountered that trigger this, but GLSlang is one I was able to quickly fix and verify it appears to stops the leak.

Repro: https://github.com/jamesdolan/safari_leak

Adding the problematic function(s) to ASYNCIFY_REMOVE also avoids the issue FWIW.

Version of emscripten/emsdk:

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 4.0.22 (0f3d2e62bccf8e14497ff19e05a1202c51eb0c65)
clang version 22.0.0git (https:/github.com/llvm/llvm-project c7706d9472fe880ba1d3418919ad4185710c9559)
Target: wasm32-unknown-emscripten
Thread model: posix

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions