em++: warning: -pthread + ALLOW_MEMORY_GROWTH may run non-wasm code slowly

31 views
Skip to first unread message

John Dallman

unread,
Sep 11, 2026, 9:54:07 AMSep 11
to emscripte...@googlegroups.com
I'm getting this warning from the Emscripten 6.0.4 version of em++ 

em++: warning: -pthread + ALLOW_MEMORY_GROWTH may run non-wasm code slowly, see https://github.com/WebAssembly/design/issues/1271 [-Wpthreads-mem-growth]

Since issue 1271 was closed in May 2025, should the warning still be produced? 

Thanks in advance.

John



Alon Zakai

unread,
Sep 11, 2026, 12:54:33 PMSep 11
to emscripte...@googlegroups.com
Ah, we need to improve that message. I'll open a PR.

The current situation AFAIK is this:

1. The design repo bug was closed because there is nothing more to be done on the design side. The intended solution is growable SharedArrayBuffer,


2. That landed in major browsers around 2024, but Firefox only implemented it fully in 2026,


3. If you are ok with targeting only browsers that support that feature - most modern ones, but only very recent Firefox - you can pass

-sGROWABLE_ARRAYBUFFERS=2

Mode 2 there is "force this feature on, do not build in any fallback support for browsers without full compatibility".



--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/emscripten-discuss/CAH1xqgk0UWZ7vV15nMj3d-J5jHyEy_p%3DJKLHG-HC7GOrOFVtDg%40mail.gmail.com.

Alon Zakai

unread,
Sep 11, 2026, 1:03:49 PMSep 11
to emscripte...@googlegroups.com

John Dallman

unread,
Sep 16, 2026, 5:37:07 AMSep 16
to emscripte...@googlegroups.com
Alon wrote:

> 1. The design repo bug was closed because there is nothing more to be done on the design side. 
> The intended solution is growable SharedArrayBuffer,

I don't think I understand the implications of a growable SharedArrayBuffer. My knowledge of JavaScript is quite limited. 

I'm porting a large mathematical modelling library to WebAssembly, along with its test harness. I am not providing a JavaScript binding for it: the intention is that the consumers of the library will call it from C/C++ code compiled for WebAssembly.  

Does this have implications for the effects of growable SharedArrayBuffer?

Thanks,

John 

Alon Zakai

unread,
Sep 16, 2026, 5:20:12 PMSep 16
to emscripte...@googlegroups.com
The issue is an interaction with JavaScript, when a growable SharedArrayBuffer is grown. There can be some overhead there, on the JavaScript side.

If you aren't writing any JavaScript yourself, then the danger of a slowdown is small. Though there are some places Emscripten itself uses JavaScript (when you need to call Web APIs, say to render or download a file), so the danger is not zero.

If you don't see a slowdown (say, comparing the non-pthread version to a pthread version that uses only one thread), then there is nothing to worry about.

But if your users are on new-enough browsers, I would recommend building with

-sGROWABLE_ARRAYBUFFERS=2

to avoid any danger of a slowdown.


John Dallman

unread,
Sep 17, 2026, 12:15:16 PM (14 days ago) Sep 17
to emscripte...@googlegroups.com
Since I don't have any users yet, I'm not shy about requiring reasonably modern browsers. FireFox 154 should be OK. 

Thanks!

John

Reply all
Reply to author
Forward
0 new messages