From 154a6c210d89cf4270ff32fc9c996c8d8b5de63e Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 18 Nov 2015 18:13:23 -0800 Subject: receive TOTAL_MEMORY from emscripten in wasm.js --- src/wasm-js.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/wasm-js.cpp') diff --git a/src/wasm-js.cpp b/src/wasm-js.cpp index 2da076329..0bc551bf8 100644 --- a/src/wasm-js.cpp +++ b/src/wasm-js.cpp @@ -52,7 +52,9 @@ extern "C" void EMSCRIPTEN_KEEPALIVE load_asm(char *input) { Ref asmjs = builder.parseToplevel(input); module = new Module(); - module->memory.initial = module->memory.max = 16*1024*1024; // TODO: receive this from emscripten + module->memory.initial = module->memory.max = EM_ASM_INT_V({ + return Module['providedTotalMemory']; // we receive the size of memory from emscripten + }); #if WASM_JS_DEBUG std::cerr << "wasming...\n"; -- cgit v1.2.3