-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
[wasm-ld] How to specify a non-growable memory without --initial-memory
and --max-memory
#81932
Comments
@llvm/issue-subscribers-lld-wasm Author: Sam Clegg (sbc100)
Until recently the way to specify a non-growable memory was to specify both `--initial-memory` and `--max-memory` and set them to the same value. This is what emscripten currently does by default unless you opt into `-sALLOW_MEMORY_GROWTH`.
However, we recently added a new When attempting to start using this flag in emscripten we discovered that there is no way to use the It seems that we need some kind of flag like the existing Instead perhaps we can add Perhaps the existing |
We recently added `--initial-heap` - an option that allows one to up the initial memory size without the burden of having to know exactly how much is needed. However, in the process of implementing support for this in Emscripten (emscripten-core/emscripten#21071), we have realized that `--initial-heap` cannot support the use-case of non-growable memories by itself, since with it we don't know what to set `--max-memory` to. We have thus agreed to move the above work forward by introducing another option to the linker (see emscripten-core/emscripten#21071 (comment)), one that would allow users to explicitly specify they want a non-growable memory. This change does this by introducing `--no-growable-memory`: an option that is mutally exclusive with `--max-memory` (for simplicity - we can also decide that it should override or be overridable by `--max-memory`. In Emscripten a similar mix of options results in `--no-growable-memory` taking precedence). The option specifies that the maximum memory size should be set to the initial memory size, effectively disallowing memory growth. Closes #81932.
Until recently the way to specify a non-growable memory was to specify both
--initial-memory
and--max-memory
and set them to the same value. This is what emscripten currently does by default unless you opt into-sALLOW_MEMORY_GROWTH
.However, we recently added a new
--initial-heap
flag which allows the user to set and initial heap size and have the linker then derive the initial memory size based on the sum of stack size + heap size + static data size. See #75594.When attempting to start using this flag in emscripten we discovered that there is no way to use the
--initial-heap
flag and still get a non-growable memory. See https://github.com/emscripten-core/emscripten/pull/21071/files#r1491731562.It seems that we need some kind of flag like the existing
--growable-table
flag. It would be nice to add--growable-memory
except that would mean changing the default to non-growable, which is perhaps too much of a breaking change. @sunfishcode WDYT?Instead perhaps we can add
--no-growable-memory
?Perhaps the existing
--growable-table
flag could also take ano-
prefix so that they were symmetrical?The text was updated successfully, but these errors were encountered: