From 3cde7acb07202af8f04f73eaaa9c7579e19a32cf Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 22 Mar 2016 15:06:03 -0700 Subject: add memory growth testcase --- test/grow_memory.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/grow_memory.cpp (limited to 'test/grow_memory.cpp') diff --git a/test/grow_memory.cpp b/test/grow_memory.cpp new file mode 100644 index 000000000..b8f732f7a --- /dev/null +++ b/test/grow_memory.cpp @@ -0,0 +1,20 @@ +#include +#include +#include + +volatile int writeOnly; + +int main() { + EM_ASM({ + assert(HEAPU8.length === 16*1024*1024); + }); + for (int i = 0; i < 20; i++) { + printf("alloc 1MB: %d\n", i); + writeOnly = (int)malloc(1024*1024); + } + EM_ASM({ + assert(HEAPU8.length > 16*1024*1024); + }); + printf("ok.\n"); +} + -- cgit v1.2.3