mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-12 02:13:04 +08:00
check_discard ran trim_allocate again for its returned-regions case, which writes the blocks into trim_blocks, the array check_trim had freed. Where glibc maps an 8 MB block by itself (its adaptive mmap threshold, which the allocator's heap policy leaves alone unless transparent huge pages are in madvise mode), the free unmaps it and the worker thread's first write faults. The case now allocates the array again and frees it. The check that a worker takes the free blocks set aside compared the highest block it carved with that of the worker before it, which took its blocks from free lists below the slice's frontier, and it passed when a worker never took them. Each run now counts the blocks it allocates past the highest block of the class so far: at most the bump room the slice had left, against all of them when a worker does not take the free blocks. The residency bound after a discard allows for pre-fault requests still in flight.