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

INITIAL_MEMORY error when trying to set MAXIMUM_MEMORY #23211

Open
mzukovec opened this issue Dec 18, 2024 · 1 comment
Open

INITIAL_MEMORY error when trying to set MAXIMUM_MEMORY #23211

mzukovec opened this issue Dec 18, 2024 · 1 comment

Comments

@mzukovec
Copy link

Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.73 (ac676d5)

Issue
When trying to allocate maximal initial memory, there is an error:
em++: error: MAXIMUM_MEMORY cannot be less than INITIAL_MEMORY

As I've inspected the code behind, it's due to the fact that INITIAL_MEMORY can be incremented withing the link.py -> inc_initial_memory which is quite a big increment in case of -phtread and -fsanitize=address, which is my case.

Can we make this more user friendly? Maybe some kind of check that it's capped to MAXIMUM_MEMORY.

Failing command line in full:

// cat main.cpp
int main() {
  return 0;
}
em++ main.cpp -o main.html -stdlib=libc++ -fsanitize=address -pthread -sSHARED_MEMORY=1 -sINITIAL_MEMORY=4288413696 -sMAXIMUM_MEMORY=4294967296 -sALLOW_MEMORY_GROWTH=1


em++: warning: -pthread + ALLOW_MEMORY_GROWTH may run non-wasm code slowly, see https://github.com/WebAssembly/design/issues/1271 [-Wpthreads-mem-growth]
(print from link.py) INITIAL_MEMORY 4902027264
(print from link.py) MAXIMUM_MEMORY 4294967296
em++: error: MAXIMUM_MEMORY cannot be less than INITIAL_MEMORY
@sbc100
Copy link
Collaborator

sbc100 commented Dec 18, 2024

Yes, its certainly looks like we got at least give a better error here. ASAN requires a lot of extra memory but that way we calculate this and inject it into the exiting memory is pretty delicate/hairy.

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