aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-12-17 16:25:51 -0800
committerAlon Zakai <alonzakai@gmail.com>2011-12-17 16:25:51 -0800
commit08191fe5f719092c3b5fe283bb76514485edc10d (patch)
tree2ca7420a4c8550189cb102a9ea07a774f2184a64
parentdf588104c7df7316a113fdf9930d3d16f7ce2567 (diff)
fix bug with allocate not allocating enough memory (just a problem for the assertion of writing over STATICTOP, as otherwise alignment of later allocations fixes it)
-rw-r--r--src/preamble.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/preamble.js b/src/preamble.js
index 293ddcf6..51e22390 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -461,10 +461,10 @@ function allocate(slab, types, allocator) {
size = slab.length;
}
- var ret = [_malloc, Runtime.stackAlloc, Runtime.staticAlloc][allocator === undefined ? ALLOC_STATIC : allocator](Math.max(size, 1));
-
var singleType = typeof types === 'string' ? types : null;
+ var ret = [_malloc, Runtime.stackAlloc, Runtime.staticAlloc][allocator === undefined ? ALLOC_STATIC : allocator](Math.max(size, singleType ? 1 : types.length));
+
var i = 0, type;
while (i < size) {
var curr = zeroinit ? 0 : slab[i];