| 136 | 136 | | `tl_dup_shared` | A block is shared. | |
| 137 | 137 | | `tl_free` | Perceus has moved a unique cell's children out (drop specialisation). | |
| 139 | +**Freeing is iterative.** Dead blocks go onto a per-actor worklist, so dropping a million-element list never recurses. This is essential on fiber stacks. **It is also done in steps** (issue #158, ADR 0002): a drop frees at most 4,096 blocks and sets `reductions` to 0, so the actor's next function entry calls `tl_preempt`. Freeing continues each time the actor is preempted or woken, and before it ends. Arrays of more than 4,096 elements are released from their end, 65,536 elements per step. Code that needs every block freed (the leak oracle mid-program, as the spike does) yields until `tl_stats_live_blocks()` is back to what it expects. |
| 141 | 141 | **Leak oracle:** with the `stats` feature (on by default), `tl_stats_live_blocks()` counts live blocks, and `LOUISE_LEAKS` makes `tl_report_leaks` print it at exit. Tests require 0. The `fast` and `lto` runtimes that release builds link (ADR 0031, ADR 0032) are built without `stats`: `tl_stats_live_blocks()` returns −1, and `LOUISE_LEAKS` prints `live blocks: unknown` with a pointer to `LOUISE_RUNTIME=checked`. |