Skip to content

Commit 2cb81d0

Browse files
committed
test(qwp): release test-owned native memory before the leak check fires (M7)
- BackgroundDrainerDurableAckRetryTest (the M7 finding): every ScriptedFactory allocated a StubWebSocketClient whose real super-ctor eagerly mallocs ~128 KB of native buffers (64K recv + 64K send + 256B control), never closed -- 18 tests, ~2.3 MB leaked per class run, and no assertMemoryLeak wrapping unlike its siblings. Stubs are now tracked in LIVE_STUBS and closed by a local assertMemoryLeak wrapper in a finally INSIDE the wrapped lambda -- LeakCheck fires at the end of the lambda, so an @After-only close would run too late. @after keeps an idempotent closeAllStubs() as a safety net for non-wrapped exits. - QwpColumnBatchViewsTest: same anti-pattern -- 58 tests tracked their native allocations but freed them in @after, after each test's LeakCheck. Redirected to a local wrapper that frees inside the lambda. - EngineCloseSlotLockReleaseTest: the sabotaged close() NPEs before reaching the watermark, and the manual cleanup captured ring+manager but forgot the AckWatermark's 16-byte mmap. Now captured and closed. All three were invisible to the leak check because it tolerated growth confined to a single memory tag; the next commit removes that tolerance.
1 parent 31066e1 commit 2cb81d0

3 files changed

Lines changed: 679 additions & 568 deletions

File tree

0 commit comments

Comments
 (0)