aboutsummaryrefslogtreecommitdiff
path: root/src/shell_sharedlib.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-08-30 21:32:56 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-09-03 14:41:30 -0700
commitbeb08e214984a234c82d3a2fd7e984dffdf2f5dc (patch)
tree560045c39234230ca0253f385da5c10e582fef90 /src/shell_sharedlib.js
parentd6e21d7851004b2853327d1de468e25ee97fe595 (diff)
clean up shared modules when dlclose()d
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}}