Skip to content

Commit

Permalink
fix(xsnap): orderly fail-stop on heap exhaustion
Browse files Browse the repository at this point in the history
  • Loading branch information
dckc committed Feb 24, 2021
1 parent 4f0ce64 commit 8ffbaa6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/xsnap/test/test-xsnap.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,3 +347,17 @@ test('normal close of pathological script', async t => {
await vat.terminate();
await hang;
});

test('heap exhaustion: orderly fail-stop', async t => {
const grow = `
let stuff = '1234';
while (true) {
stuff = stuff + stuff;
}
`;
for await (const debug of [false, true]) {
const vat = xsnap({ ...xsnapOptions, meteringLimit: 0, debug });
t.teardown(() => vat.terminate());
await t.throwsAsync(vat.evaluate(grow));
}
});

0 comments on commit 8ffbaa6

Please sign in to comment.