mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-01 07:33:12 +08:00
Each thread keeps up to 8 MB of arena chunks and up to 64 dropped arenas for reuse (scr_arena.c). Nothing freed them when a worker thread finished, so every worker that used a group arena left its pool behind: 40 workers run one after another, each dropping a 12 MB arena, kept 328 MB resident. scr_arena_thread_exit frees the calling thread's pooled arenas and chunks. The worker thread calls it after its context cleanup, before it posts the exit event. The new harness test runs 24 such workers in sequence and checks that the resident set grows by less than 32 MiB over the last 20 (160 MiB before this change, 1 MiB after).