Memory Load Test on Deno

test.ts:

let a1 : Uint8Array = new Uint8Array(1000 * 1000 * 1000)
let a2 : Uint8Array = new Uint8Array(1000 * 1000 * 1000)
let a3 : Uint8Array = new Uint8Array(1000 * 1000 * 1000)
let a4 : Uint8Array = new Uint8Array(1000 * 1000 * 1000)
let a5 : Uint8Array = new Uint8Array(1000 * 1000 * 1000)

for (let index = 0; index < a1.length; index++) {
    a1[index] = index % 254
    a2[index] = (index+1) % 254
    a3[index] = (index+2) % 254
    a4[index] = (index+3) % 254
    a5[index] = (index+4) % 254
}

// Try using about 8gb of memory
await Deno.writeFile("a1.bin",a1)
await Deno.writeFile("a2.bin",a2)
await Deno.writeFile("a3.bin",a3)
await Deno.writeFile("a4.bin",a4)
await Deno.writeFile("a5.bin",a5)Code language: JavaScript (javascript)

Command to run:

deno run -A test.tsCode language: Bash (bash)

Command to run with more allowed memory:

deno run --v8-flags=--max-old-space-size=8000 --allow-read --allow-write test.tsCode language: Bash (bash)

Posted

in

,

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.