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

wasm: memory usage #25975

Closed
Jinex2012 opened this issue Jun 20, 2018 · 5 comments
Closed

wasm: memory usage #25975

Jinex2012 opened this issue Jun 20, 2018 · 5 comments

Comments

@Jinex2012
Copy link

Jinex2012 commented Jun 20, 2018

I was monitoring the memory usage (using Safari developer tools) on an empty wasm program:

package main

func main() {

}

with the example here https://github.com/golang/go/tree/master/misc/wasm

When the page loads, the memory usage is 1.01GB. When I click on run the memory usage becomes 3.01GB

but on Google Chrome the memory usage is 17.5MB / 25.6MB (clicking on run has no memory effect)

Is this a browser compatibility issue?

cc @neelance

@neelance
Copy link
Member

We currently have to request a large amount of initial memory, because requesting more memory later is a relatively slow operation. Most of the memory is never used, so the WebAssembly runtime and/or the operating system should be able to not actually allocate physical memory for it. We will probably revise this in the future.

@agnivade
Copy link
Contributor

Looks like there is nothing much to be done here. Closing it. Feel free to comment if you disagree.

@pwfff
Copy link

pwfff commented Oct 24, 2018

I recently had to turn this value down and recompile Go when trying to fit a Go compiled WASM into a Cloudflare Worker, since it only allows you to request 2048 pages of memory: Uncaught CompileError: WebAssembly compilation: Wasm decoding failed: initial memory size (16384 pages) is larger than implementation limit (2048).

Of course, even after I got past that error my worker immediately tried to allocate too much memory and crashed... but there are use cases for low-memory WASM modules.

@neelance
Copy link
Member

We will definitely address this as soon as WebAssembly has the necessary features.

@pwfff
Copy link

pwfff commented May 8, 2019

This may be fixed/better with #27462

@golang golang locked and limited conversation to collaborators May 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants