| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 79262ff commit 7682e7e
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,13 +4,19 @@ | |||
| 4 | 4 | // wasm memory64 with guard regions reserves 16GB of virtual address space. | |
| 5 | 5 | 'use strict'; | |
| 6 | 6 | ||
| 7 | - require('../common'); | ||
| 7 | + const common = require('../common'); | ||
| 8 | 8 | const assert = require('assert'); | |
| 9 | + const { isMainThread } = require('worker_threads'); | ||
| 9 | 10 | ||
| 10 | 11 | // The first allocation should succeed. | |
| 11 | 12 | const first = new WebAssembly.Memory({ address: 'i64', initial: 10n, maximum: 100n }); | |
| 12 | 13 | assert(first); | |
| 13 | 14 | ||
| 15 | + if (!isMainThread) { | ||
| 16 | + // https://github.com/nodejs/node/issues/62870 | ||
| 17 | + common.skip('Workers terminate instead of throwing'); | ||
| 18 | + } | ||
| 19 | + | ||
| 14 | 20 | // Subsequent allocations should eventually fail due to running out of | |
| 15 | 21 | // virtual address space. memory64 reserves 16GB per allocation (vs 8GB for | |
| 16 | 22 | // memory32), so the limit is reached even faster. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,5 +4,24 @@ | |||
| 4 | 4 | // wasm memory32 with guard regions reserves 8GB of virtual address space. | |
| 5 | 5 | 'use strict'; | |
| 6 | 6 | ||
| 7 | - require('../common'); | ||
| 8 | - new WebAssembly.Memory({ initial: 10, maximum: 100 }); | ||
| 7 | + const common = require('../common'); | ||
| 8 | + const assert = require('assert'); | ||
| 9 | + const { isMainThread } = require('worker_threads'); | ||
| 10 | + | ||
| 11 | + // The first allocation should succeed. | ||
| 12 | + const first = new WebAssembly.Memory({ initial: 10, maximum: 100 }); | ||
| 13 | + assert(first); | ||
| 14 | + | ||
| 15 | + if (!isMainThread) { | ||
| 16 | + // https://github.com/nodejs/node/issues/62870 | ||
| 17 | + common.skip('Workers terminate instead of throwing'); | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + // Subsequent allocations should eventually fail due to running out of | ||
| 21 | + // virtual address space. | ||
| 22 | + assert.throws(() => { | ||
| 23 | + const instances = [first]; | ||
| 24 | + for (let i = 1; i < 30; i++) { | ||
| 25 | + instances.push(new WebAssembly.Memory({ initial: 10, maximum: 100 })); | ||
| 26 | + } | ||
| 27 | + }, /WebAssembly\.Memory/); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments