emscripten-core / emscripten-core/emscripten

Use postMessage to transfer side modules between workers

Open
#17,078 2 comments 0 reactions 0 assignees View on GitHub
dynamic_linking multithreading
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

### Discussed in https://github.com/emscripten-core/emscripten/discussions/17034

Originally posted by **alexander-veselov** May 24, 2022
I understand that "SIDE_MODULE + USE_PTHREADS" is experimental. But I would still like to know if this is a known issue and if it can be fixed somehow.

We have a lot of side modules (about 350MB). USE_PTHREADS=1 and PTHREAD_POOL_SIZE=20. With this configuration, an "out of memory" error occurs. It seems that all side modules are loaded several times for each thread.

For example, if you set PTHREAD_POOL_SIZE=1, then the problem will disappear.
I know that when building without side modules, the problem will also disappear, but we need side modules.

Is it possible to make threads use shared memory and not load copies of dynamic libs several times?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.