Minor buddy alloc tweaks; Share entire allocator testing infrastructure

This commit is contained in:
dcodeIO
2018-02-20 18:40:30 +01:00
parent d8cdb663cb
commit 16ffddc5d5
12 changed files with 953 additions and 1761 deletions

View File

@ -35,7 +35,8 @@ function runner(allocator, runs, allocs) {
var base = allocator.allocate_memory(64);
console.log("base: " + base);
allocator.free_memory(base);
console.log("mem initial: " + allocator.memory.buffer.byteLength);
var currentMem = allocator.memory.buffer.byteLength;
console.log("mem initial: " + currentMem);
try {
for (var j = 0; j < runs; ++j) {
@ -64,6 +65,10 @@ function runner(allocator, runs, allocs) {
if (ptr !== base)
throw Error("expected " + base + " but got " + ptr);
allocator.free_memory(ptr);
if (allocator.memory.buffer.byteLength > currentMem) {
currentMem = allocator.memory.buffer.byteLength;
console.log("mem changed: " + currentMem);
}
}
} finally {
// mem(allocator.memory, 0, 0x10000);