How often does it reproduce? Is there a required condition?
Most time
What is the expected behavior?
Run successfully and print
314572800
314572804
What do you see instead?
UnhandledPromiseRejectionWarning: RangeError: Array buffer allocation failed
at new ArrayBuffer ()
at new Uint8Array ()
at new FastBuffer (internal/buffer.js:951:1)
at createUnsafeBuffer (buffer.js:152:12)
at allocate (buffer.js:422:10)
at Function.allocUnsafe (buffer.js:387:10)
at Function.concat (buffer.js:567:25)
at test (C:\Users\fluentwind\WebstormProjects\esign\test\testBuffer.js:3:15)
at test2 (C:\Users\fluentwind\WebstormProjects\esign\test\testBuffer.js:11:14)
at Object. (C:\Users\fluentwind\WebstormProjects\esign\test\testBuffer.js:14:1)
Additional information
I want to concat a buffer and get a full buffer.
But memory usage never goes down. Is there anything wrong with gc?
Version
12.22.0 32bit
Platform
windows 10 20H2 x64
Subsystem
No response
What steps will reproduce the bug?
const test = async function (b1) { b1 = Buffer.concat([b1, Buffer.from('\n')]) b1 = Buffer.concat([b1, Buffer.from('\n')]) b1 = Buffer.concat([b1, Buffer.from('\n')]) b1 = Buffer.concat([b1, Buffer.from('\n')]) return b1 } const test2 = async () => { let b1 = Buffer.alloc(1024 1024 300, '1') console.log(b1.length) b1 = await test(b1) console.log(b1.length) } test2()
How often does it reproduce? Is there a required condition?
Most time
What is the expected behavior?
Run successfully and print 314572800 314572804
What do you see instead?
UnhandledPromiseRejectionWarning: RangeError: Array buffer allocation failed at new ArrayBuffer ()
at new Uint8Array ()
at new FastBuffer (internal/buffer.js:951:1)
at createUnsafeBuffer (buffer.js:152:12)
at allocate (buffer.js:422:10)
at Function.allocUnsafe (buffer.js:387:10)
at Function.concat (buffer.js:567:25)
at test (C:\Users\fluentwind\WebstormProjects\esign\test\testBuffer.js:3:15)
at test2 (C:\Users\fluentwind\WebstormProjects\esign\test\testBuffer.js:11:14)
at Object. (C:\Users\fluentwind\WebstormProjects\esign\test\testBuffer.js:14:1)
Additional information
I want to concat a buffer and get a full buffer.
But memory usage never goes down. Is there anything wrong with gc?