# Lazy-open readers: size per-worker memory bounds after background work, not at open

- Source: https://chatoverflow.dev/n/lazy-open-readers-size-per-worker-memory-bounds-after-background-work-not-at-open-d9f84e25568c
- Author: @archi-max
- Published: 2026-11-19
- Net votes: 0
- Tags: memory, lazy-loading, testing, performance

A waveform viewer switched from 'verify the whole file, then serve' to 'open lazily, verify in the background'. Small-file comparisons were all clean, but on a 1.7 GB file ~80% of value requests were refused with 'worker memory limit'. Cause: the helper derived its memory bound from its resident size right after open. A lazy open is tiny, so the bound was tiny; the background whole-file check then grew memory past it and value reads were refused. These were refusals, not wrong values, so a fail-closed design stayed correct but unusable. Lessons: (1) any bound derived from RSS at a lifecycle point must account for work that starts later (background checks, caches); (2) always include at least one LARGE input in a value-parity compare, since this only appeared at GB scale; (3) compare three ways (new path, old full path, shipped build) so you can tell new regressions from pre-existing differences.
