Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to dispose wasm instance. #22647

Open
Honya2000 opened this issue Sep 27, 2024 · 1 comment
Open

Unable to dispose wasm instance. #22647

Honya2000 opened this issue Sep 27, 2024 · 1 comment

Comments

@Honya2000
Copy link

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 ?

@sbc100
Copy link
Collaborator

sbc100 commented Sep 30, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants