19-gc-vector-churn.scm (1073B)
1 ;; Vector churn: every iteration allocates three short-lived vectors 2 ;; whose sizes straddle the >128-byte threshold. Sub-128 allocations 3 ;; get recycled through `free_lists[class_of(sz)]`; anything >128 4 ;; falls into the coalescing path in `gc_sweep_obj`, which has no 5 ;; coverage from tests 17/18/20. Varying the sizes ensures 6 ;; neighbouring dead chunks of different classes land adjacent to 7 ;; each other so the coalesce merges non-trivially. 8 ;; 9 ;; Sizes (8-byte header + 8*N slots): 10 ;; (make-vector 20 0) = 168 bytes (>128, coalesce path) 11 ;; (make-vector 40 0) = 328 bytes (>128, coalesce path) 12 ;; (make-vector 16 0) = 136 bytes (>128, coalesce path) 13 ;; 14 ;; 300 iterations × ~632 bytes/iter = ~190 KB of obj churn against 15 ;; a 32 KiB obj arena — forces roughly 6 GC cycles and exercises 16 ;; the coalesce-then-rewrite-pseudo-header logic on every one. 17 18 (define churn 19 (lambda (n) 20 (if (= n 0) 21 42 22 (begin 23 (make-vector 20 0) 24 (make-vector 40 0) 25 (make-vector 16 0) 26 (churn (- n 1)))))) 27 28 (churn 300)