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

Respect the WASM_MEM_MAX limit in memory growth #6937

Merged
merged 5 commits into from
Aug 10, 2018
Merged

Conversation

kripken
Copy link
Member

@kripken kripken commented Aug 2, 2018

If the user specified a limit, it is set in the wasm binary, and we can't (and shouldn't) grow past it.

Also the docs in settings.js about this were wrong.

See #6042 (comment)

src/preamble.js Outdated
@@ -1027,6 +1027,20 @@ function enlargeMemory() {
}
}

#if WASM_MEM_MAX != -1
// A limit was set for how much we can grow. We should not exceed that
// (the wasm binary specifies it, so if we tried, we'd fail anyhow).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand why this is necessary. If WASM_MEM_MAX causes the binary to set the limit, then reallocBuffer should fail and we'd fail down on line 1051? But from the linked issue it looks like we are not, so maybe something else is wrong?

Copy link
Member Author

@kripken kripken Aug 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, maybe this should be explained better. The issue is if we are 64MB and the max is 100MB, then we normally double the size - so we'd try to 64->128MB, which fails. Instead, with this PR, we'll try for 64->100MB, which might work.

Copy link
Member

@dschuff dschuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it, LGTM

@kripken kripken merged commit d828e76 into incoming Aug 10, 2018
@kripken kripken deleted the wasm-mem-max branch August 10, 2018 23:41
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

Successfully merging this pull request may close these issues.

None yet

2 participants