emscripten
emscripten copied to clipboard
Unable to dispose wasm instance.
Hello,
In my app design i'm compiling WASM once and have to create several instances of WASM on different events. But i have no idea how to dispose those instances, when i don't need them. I googled the issue and found that it uses normal garbage collector, so if instance not referenced - it is automatically destroyed. But this seems doesn't work. The point is my WASM project uses pthreads. And when i instantiate it - i see 8 additional threads (em-pthread) in workers list. But when i set this.wasmInstance to null - Threads aren't disposed. So i guess instance is not garbage collected.
So how can i properly destroy WASM instances then ?
Can you try building with -sEXIT_RUNTIME=1 and then calling exit()? The runtime shutdown process should terminate all the workers.