SIDE_MODULE and USE_PTHREADS provoke memory growth #17034
-
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. Is it possible to make threads use shared memory and not load copies of dynamic libs several times? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
@sbc100 Is it the case that loading a dynamic library compiles on that pthread, so each pthread ends up recompiling the same code? (Unlike with the main module, which we compile once and just send that to the workers.) I'm not sure how we could improve that. To send the compiled dynamic library we'd need to do an async |
Beta Was this translation helpful? Give feedback.
@sbc100 Is it the case that loading a dynamic library compiles on that pthread, so each pthread ends up recompiling the same code? (Unlike with the main module, which we compile once and just send that to the workers.)
I'm not sure how we could improve that. To send the compiled dynamic library we'd need to do an async
postMessage
. Perhaps with Asyncify or stack switching we could pause and wait for that.