Summary#
Apparent leaks in iterative benchmarks are often measurement artifacts caused by deferred callbacks spilling across iterations. Before blaming product code, make the harness flush queued async work, then compare variants to see whether growth follows the system under test or the benchmark loop itself. This is especially important when producer and consumer run in the same process.
Problem#
Heap usage can appear to climb steadily even with forced GC because scheduled tasks from earlier iterations have not executed yet, producing false leak signals.
Solution#
Insert explicit queue-drain points between iterations, run GC only after deferred work is flushed, and use A/B checks across fixtures or runtime versions to confirm the leak is real.
Failure Modes#
- Calling GC before immediates or microtasks have drained
- Measuring tightly looped iterations that accumulate background work
- Combining multiple subsystems in one process without isolating their queued tasks
- Declaring a leak from benchmark-only growth without a control comparison
Sources#
- https://github.com/Comfy-Org/ComfyUI/pull/14701
- https://github.com/Comfy-Org/ComfyUI/pull/14724
- https://github.com/Comfy-Org/ComfyUI/pull/14102
- https://github.com/Comfy-Org/ComfyUI/pull/14869
- https://github.com/Comfy-Org/ComfyUI/pull/14867
- https://github.com/Comfy-Org/ComfyUI/pull/14853
- https://github.com/Comfy-Org/ComfyUI/pull/14424
- https://github.com/Comfy-Org/ComfyUI/pull/14862
- https://github.com/Comfy-Org/ComfyUI/pull/14643
- https://github.com/GitHubDaily/GitHubDaily/pull/267
- https://github.com/GitHubDaily/GitHubDaily/pull/52
- https://github.com/fastapi/full-stack-fastapi-template/pull/2364
- https://github.com/fastapi/full-stack-fastapi-template/pull/2333
- https://github.com/fastapi/full-stack-fastapi-template/pull/2375
- https://github.com/fastapi/full-stack-fastapi-template/pull/2361
- https://github.com/fastapi/full-stack-fastapi-template/pull/2359
- https://github.com/fastapi/full-stack-fastapi-template/pull/2368
- https://github.com/fastapi/full-stack-fastapi-template/pull/2369
- https://github.com/fastapi/full-stack-fastapi-template/pull/2343
- https://github.com/fastapi/full-stack-fastapi-template/pull/2362
- https://github.com/fastapi/full-stack-fastapi-template/pull/2367
- https://github.com/fastapi/full-stack-fastapi-template/pull/2360
- https://github.com/react/react/pull/36980
- https://github.com/react/react/pull/36965
- https://github.com/react/react/pull/36964
- https://github.com/react/react/pull/36963
- https://github.com/react/react/pull/36962
- https://github.com/react/react/pull/36967
- https://github.com/react/react/pull/36968
- https://github.com/react/react/pull/36969
- https://github.com/thedaviddias/Front-End-Checklist/pull/664
- https://github.com/thedaviddias/Front-End-Checklist/pull/680
- mined_at: 2026-07-10T20:53:28Z
Sagwan Revalidation 2026-07-10T21:30:41Z#
- verdict:
ok - note: 비동기 작업 배출 후 메모리 측정하라는 권고는 여전히 유효함
Sagwan Revalidation 2026-07-12T14:54:05Z#
- verdict:
ok - note: 비동기 작업 배수 후 메모리 측정하라는 권고는 여전히 유효함
Sagwan Revalidation 2026-07-14T11:31:22Z#
- verdict:
ok - note: 비동기 큐 배출 후 GC·측정하라는 권고는 현재도 유효함
Sagwan Revalidation 2026-07-16T11:45:42Z#
- verdict:
ok - note: 비동기 큐 배출 후 메모리 측정 원칙은 현재도 유효하다.
Sagwan Revalidation 2026-07-18T13:40:05Z#
- verdict:
ok - note: 일반 원칙 중심이라 최근 practice와 충돌 없고 재사용 가능함
Sagwan Revalidation 2026-07-20T14:20:03Z#
- verdict:
ok - note: 비동기 큐 배출 후 GC·측정하라는 권장안은 현재도 유효하다.