aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Pesch <inolen@gmail.com>2013-08-31 22:29:52 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-09-03 14:41:31 -0700
commitd555f96ace2cd497ab9f66cfe6ae328d8e52b67c (patch)
tree45b5908981959568aee0f6ec330cd22c74edee79
parent2a29c25394abf9941f4a768a810c417f506e1678 (diff)
free H_BASE on cleanup
-rw-r--r--src/jsifier.js2
-rw-r--r--src/shell_sharedlib.js2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 460660b4..ce08fdde 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -1665,7 +1665,7 @@ function JSify(data, functionsOnly, givenFunctions) {
print('STATIC_BASE = ' + Runtime.GLOBAL_BASE + ';\n');
print('STATICTOP = STATIC_BASE + ' + Runtime.alignMemory(Variables.nextIndexedOffset) + ';\n');
} else {
- print('var H_BASE = parentModule["_malloc"](' + Runtime.alignMemory(Variables.nextIndexedOffset) + ' + Runtime.GLOBAL_BASE);\n');
+ print('H_BASE = parentModule["_malloc"](' + Runtime.alignMemory(Variables.nextIndexedOffset) + ' + Runtime.GLOBAL_BASE);\n');
print('// STATICTOP = STATIC_BASE + ' + Runtime.alignMemory(Variables.nextIndexedOffset) + ';\n'); // comment as metadata only
}
}
diff --git a/src/shell_sharedlib.js b/src/shell_sharedlib.js
index 33fb521c..c070c617 100644
--- a/src/shell_sharedlib.js
+++ b/src/shell_sharedlib.js
@@ -9,12 +9,14 @@
Module.cleanups = [];
#if ASM_JS
+ var H_BASE = 0;
// 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
+ parentModule['_free'](H_BASE);
});
#endif