Skip to content

wasm64: support memory larger than 16 GB #1892

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

Open
jspanchu opened this issue Apr 17, 2025 · 6 comments
Open

wasm64: support memory larger than 16 GB #1892

jspanchu opened this issue Apr 17, 2025 · 6 comments

Comments

@jspanchu
Copy link

I asked this question at emscripten-core/emscripten#23966 and was told it's a limitation imposed by the spec.

In wasm64, the spec caps the maximum memory to 16 GB in https://github.com/WebAssembly/memory64/blob/9003cd5e24e53b84cd9027ea3dd7ae57159a6db1/document/js-api/index.bs#L1785.

Could we please get wasm64 to support as much memory available from the host machine's RAM? I'd also like to understand reasons behind the 16GB limit when technically 64-bit integers can be used to index memories much larger than 16GB.

@sbc100

@titzer
Copy link
Contributor

titzer commented Apr 17, 2025

Note this is a standard limit imposed by the JS API, it's not necessarily the same limit in other embedding contexts. Any limit is subject to future revision, but if your use case is outside of the web, then an engine could provide more memory.

@jspanchu
Copy link
Author

Note this is a standard limit imposed by the JS API

Is this documented somewhere?

@titzer
Copy link
Contributor

titzer commented Apr 17, 2025

Yes, the link you provided was into the JS-API documentation, which is technically separate from the core Wasm specification.

@jspanchu
Copy link
Author

Ah, I see. Is this due to a limitation of JS execution engines like browsers/node? Where do I lobby to increase the JS-API limit?

@sbc100
Copy link
Member

sbc100 commented Apr 17, 2025

I believe you have found the correct forum. The JS-API spec is maintained alongside the wasm core spec here: https://github.com/WebAssembly/spec/blob/main/document/js-api/index.bs.

@duolanda
Copy link

I encountered the same issue as you did, and I discovered that the 16GB memory limit is also documented in the source code of the V8 engine. : src/wasm/wasm-limits.h - v8/v8 - Git at Google
Does this imply that increasing the memory limit is difficult unless the V8 engine is updated? Or is it possible for browsers using the V8 engine to allocate more than 16GB of memory now?

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

4 participants