From 69b457cd2da748175f8fc46312c8f7b40e368205 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Sat, 5 Mar 2016 16:45:22 -0800 Subject: warn when we should grow wasm memory in mergeMemory --- src/js/wasm.js-post.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/js/wasm.js-post.js b/src/js/wasm.js-post.js index 762c1bd30..de1ee2752 100644 --- a/src/js/wasm.js-post.js +++ b/src/js/wasm.js-post.js @@ -71,7 +71,9 @@ function integrateWasmJS(Module) { // TODO: avoid this copy, by avoiding such static init writes // TODO: in shorter term, just copy up to the last static init write var oldBuffer = Module['buffer']; - assert(newBuffer.byteLength >= oldBuffer.byteLength, 'we might fail if we allocated more than TOTAL_MEMORY'); + if (newBuffer.byteLength < oldBuffer.byteLength) { + Module['printErr']('the new buffer in mergeMemory is smaller than the previous one. in native wasm, we should grow memory here'); + } var oldView = new Int8Array(oldBuffer); var newView = new Int8Array(newBuffer); if ({{{ WASM_BACKEND }}}) { -- cgit v1.2.3