emscripten icon indicating copy to clipboard operation
emscripten copied to clipboard

Unable to dispose wasm instance.

Open Honya2000 opened this issue 1 year ago • 1 comments

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 ?

Honya2000 avatar Sep 27 '24 10:09 Honya2000

Can you try building with -sEXIT_RUNTIME=1 and then calling exit()? The runtime shutdown process should terminate all the workers.

sbc100 avatar Sep 30 '24 01:09 sbc100