/** * Worker resident memory above which its heap snapshot stops being parseable. * * Measured on 2026-08-19 against the vercel/next.js#97464 reproduction, three * points: a worker at 802 MB wrote 310 MB, at 1201 MB wrote 563 MB, and at * 3010 MB wrote 2388 MB. The ratio is not flat — 0.39x, 0.47x, 0.79x — so the * 512 MB a V8 string can hold is crossed somewhere just past 1 GB of RSS. * A snapshot taken above this is written, costs the disk, and then cannot be * read (see `assertReadableSnapshot`), which is the worst of both. */ export declare const PARSEABLE_WORKER_RSS_BYTES: number; export type CaptureStage = "waiting" | "baseline-taken" | "pair-taken" | "missed"; export type CaptureDecision = "wait" | "take-baseline" | "take-after" | "give-up"; /** * Decides what to do with a worker at this resident size. * * Both snapshots have to happen low on the curve, which is not where the * interesting memory is. That is forced by the parse limit above and is the * central compromise of build-time attribution: the pair samples the start of * the growth rather than bracketing it, so the report has to say how much of * the curve it actually covers. */ export declare function decideCapture(rssBytes: number, stage: CaptureStage, baselineRssBytes?: number | null): CaptureDecision; export declare function snapshotsWrittenBy(pid: number, filenames: readonly string[]): string[]; export type CollectedPair = { baselineFile: string; afterFile: string; }; /** * Moves a worker's two snapshots out of the project and into the run's own * directory. They are the user's source tree's problem otherwise: V8 chose * where to put them, and leaving half a gigabyte of them behind in a repo * would be a poor trade for a measurement. */ export declare function collectSnapshotPair(appDir: string, outDir: string, pid: number): Promise; /** * Deletes snapshots a run wrote and cannot use — a give-up after the baseline, * or a worker whose pair never completed. Without this a failed capture leaves * hundreds of megabytes in the user's project with no report referring to them. */ export declare function discardSnapshots(appDir: string, pid: number): Promise; /** * What share of the worker's observed growth the pair actually spans. * * Reported rather than hidden because the parse limit forces the pair low: on * the #97464 reproduction the worker peaks near 3.3 GB and the pair cannot * reach past 1 GB, so the attributed bytes explain a minority of the curve. A * reader comparing the two numbers without this would conclude the rest went * unexplained. */ export declare function bracketedShare(baselineRssBytes: number, afterRssBytes: number, peakRssBytes: number): number; export declare function registerPendingCapture(appDir: string, pid: number): void; export declare function clearPendingCapture(): void; /** Best effort, synchronous, and never throws: it runs on the way out. */ export declare function discardPendingSnapshotsSync(): void;