MCPcopy Index your code
hub / github.com/nodejs/node / allocate

Function allocate

lib/buffer.js:464–477  ·  view source on GitHub ↗
(size)

Source from the content-addressed store, hash-verified

462};
463
464function allocate(size) {
465 if (size <= 0) {
466 return new FastBuffer();
467 }
468 if (size < (Buffer.poolSize >>> 1)) {
469 if (size > (poolSize - poolOffset))
470 createPool();
471 const b = new FastBuffer(allocPool, poolOffset, size);
472 poolOffset += size;
473 alignPool();
474 return b;
475 }
476 return createUnsafeBuffer(size);
477}
478
479function fromStringFast(string, ops) {
480 const maxLength = Buffer.poolSize >>> 1;

Callers 1

buffer.jsFile · 0.70

Calls 3

createPoolFunction · 0.85
alignPoolFunction · 0.85
createUnsafeBufferFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…