mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-25 06:24:27 +08:00
A script thread that exits parks its allocator arena with every freed block still resident, so the memory of a finished worker stays with the process until another thread claims the arena. On Linux, a parking thread that carved at least 16 MiB now hands back every page of its arena that holds only free blocks (MADV_DONTNEED), relinks the remaining free blocks in address order, and keeps the returned page runs as zeroed regions that the next owner carves before the slice frontier. It also trims glibc malloc. SCR_SA_STATS=1 reports what each park returned; SCR_SA_TRIM=0 turns it off.