mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-05 08:13:06 +08:00
The cycle collector widens the growth fraction that schedules full passes up to 16 times the heap left by the last pass while passes find little. Lowering a large program leaves hundreds of megabytes of cyclic garbage, and whether a scheduled pass reclaims it before the build's peak depends on where the growth rule fires: small changes to the compiler moved the peak of a tsc-ts build between 1.66 and 2.05 GB. The native compiler now sets the growth cap to 2 at startup, as SCR_CYCLE_GROWTH_CAP=2 does, so a full pass runs once the heap has grown to three times its size after the last one. scr_cyc_set_growth_cap sets the cap for a program from its own code; the environment variable still takes precedence, and child processes are not affected.