Merge pull request #3 from kobigurk/master

Make memory grow on overflowing allocation
This commit is contained in:
Jordi Baylina 2019-05-15 10:11:11 +02:00 committed by GitHub
commit e40bd0b701
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -68,6 +68,10 @@ function thread(self) {
while (i32[0] & 3) i32[0]++; // Return always aligned pointers
const res = i32[0];
i32[0] += length;
while (i32[0] > memory.buffer.byteLength) {
memory.grow(100);
}
i32 = new Uint32Array(memory.buffer);
return res;
}