]> git.proxmox.com Git - rustc.git/blame - src/binaryen/test/grow_memory.cpp
New upstream version 1.25.0+dfsg1
[rustc.git] / src / binaryen / test / grow_memory.cpp
CommitLineData
abe05a73
XL
1#include <stdio.h>
2#include <stdlib.h>
3#include <emscripten.h>
4
5volatile int writeOnly;
6
7int main() {
8 EM_ASM({
9 assert(HEAPU8.length === 16*1024*1024);
10 });
11 for (int i = 0; i < 20; i++) {
12 printf("alloc 1MB: %d\n", i);
13 writeOnly = (int)malloc(1024*1024);
14 }
15 EM_ASM({
16 assert(HEAPU8.length > 16*1024*1024);
17 });
18 printf("ok.\n");
19}
20