aboutsummaryrefslogtreecommitdiff
path: root/src/shell_sharedlib.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/shell_sharedlib.js')
-rw-r--r--src/shell_sharedlib.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/shell_sharedlib.js b/src/shell_sharedlib.js
index e57918ea..33fb521c 100644
--- a/src/shell_sharedlib.js
+++ b/src/shell_sharedlib.js
@@ -6,11 +6,16 @@
Module.print = parentModule.print;
Module.printErr = parentModule.printErr;
+ Module.cleanups = [];
+
#if ASM_JS
// Each module has its own stack
var STACKTOP = parentModule['_malloc'](TOTAL_STACK);
assert(STACKTOP % 8 == 0);
var STACK_MAX = STACKTOP + TOTAL_STACK;
+ Module.cleanups.push(function() {
+ parentModule['_free'](STACKTOP); // XXX ensure exported
+ });
#endif
{{BODY}}