Commit 9eeb808
committed
Sever UI-state generation retention via vty lastPicRef
The interactive (Brick/vty) UI retained one UIState generation per rendered
frame, unbounded: vty parks the last Picture in an IORef (lastPicRef) for
resize redraws, and Brick builds that Picture lazily -- its image/viewport
nodes are renderFinal/viewportScroll thunks closing over the UIState they
were rendered from, which through the prior render closes over the previous
UIState. The single unforced Picture is thus a thunk chain reaching back
through every frame, pinning each generation's campaigns/WorkerState/GenDict
and (on falsifying contracts) its test VM snapshots.
ghc-debug on a live process showed a single retainer path with 788 chained
renderFinal/viewportScroll thunk pairs off lastPicRef. Measured: +12 kB/s
unbounded on a trivial non-falsifying contract (interactive), and 681 MB
pinned on a 20-failing-assert stress contract.
Fixes:
- UI.hs: deep-force each Picture before handing it to vty, so lastPicRef
holds concrete images instead of a UIState-closing thunk chain (primary).
- UI.hs: force the VM-stripped test copies; `t { vm = Nothing }` was a thunk
retaining the VM-bearing original.
- Campaign.hs: bind NewCoverage.transactions strictly; `force (...)` on a
non-strict field was itself a thunk pinning the sequence's VMResults.
- Exec.hs: forceVMData now also forces vm.tx.subState, whose lazily-consed
Expr EAddr elements otherwise chain a stored VM to every intermediate VM
of its transaction.
Validated: trivial-contract interactive growth +12,071 -> +517 B/s (UIState
generation growth +4.1 MB -> +0); stress-contract live heap 681 -> 39 MB
flat; ghc-debug generation chain 788 -> 0.1 parent c929006 commit 9eeb808
3 files changed
Lines changed: 34 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
481 | 481 | | |
482 | 482 | | |
483 | 483 | | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
484 | 489 | | |
485 | 490 | | |
486 | 491 | | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
| 492 | + | |
491 | 493 | | |
492 | 494 | | |
493 | 495 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
| 339 | + | |
339 | 340 | | |
340 | 341 | | |
341 | 342 | | |
342 | 343 | | |
343 | 344 | | |
344 | 345 | | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
345 | 361 | | |
346 | 362 | | |
347 | 363 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
151 | 152 | | |
152 | 153 | | |
153 | 154 | | |
154 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
155 | 161 | | |
156 | 162 | | |
157 | 163 | | |
| |||
377 | 383 | | |
378 | 384 | | |
379 | 385 | | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
380 | 390 | | |
| 391 | + | |
381 | 392 | | |
382 | 393 | | |
383 | 394 | | |
| |||
0 commit comments