Needs Node.js 20+ to include allocations that were collected again
(see countsCollected). Only one profile can run at a time per process. Estimates are
statistical: expect accuracy within a few percent for allocations well
above the sampling interval.
Profile the allocations of
fn(sync or async).const { result, allocatedBytes, sites } = await profileAllocations(() => buildReport(data));
Needs Node.js 20+ to include allocations that were collected again (see
countsCollected). Only one profile can run at a time per process. Estimates are statistical: expect accuracy within a few percent for allocations well above the sampling interval.