-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Respect the WASM_MEM_MAX limit in memory growth (#6937)
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
- Loading branch information
Showing
5 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include <assert.h> | ||
|
||
int main() { | ||
const int MB = 1024 * 1024; | ||
// TOTAL_MEMORY starts at 64MB, and max is 100. allocate enough | ||
// to prove we can grow. 70 is enough to prove we can grow, | ||
// higher can prove we stop at the right point. | ||
for (int i = 0; 1; i++) { | ||
printf("%d\n", i); | ||
volatile int sink = (int)malloc(MB); | ||
if (!sink) { | ||
printf("failed at %d\n", i); | ||
assert(i > 70); | ||
break; | ||
} | ||
assert(i <= 100); // the wasm mem max limit, we must not get there | ||
} | ||
printf("grew memory ok.\n"); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
grew memory ok. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters