Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardNodeJSBuffer pool and allocationSingle-choice MCQ

Node's internal Buffer pool (the slab from which small Buffers are sub-allocated) has a default Buffer.poolSize of 8192. For an allocation request of N bytes, what is the exact rule that decides whether the new Buffer is carved out of the shared pool slab versus given its own dedicated ArrayBuffer?

const b1 = Buffer.allocUnsafe(100); const b2 = Buffer.allocUnsafe(5000); console.log(b1.byteOffset); console.log(b2.byteOffset);