Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
test(large-pages): start the held-heap measurement on a fresh PGLite WAL segment
garrytan20b4e007046a
diff --git a/test/large-pages/segmented-sweep-budget.test.ts b/test/large-pages/segmented-sweep-budget.test.tsindex 8a345a7c4f..e298cecec7 100644--- a/test/large-pages/segmented-sweep-budget.test.ts+++ b/test/large-pages/segmented-sweep-budget.test.ts@@ -111,6 +111,9 @@ for (const kind of testBackends()) {peak = Math.max(peak, process.memoryUsage().heapUsed);return transaction(fn);}) as BrainEngine['transaction'];+ // PGLite keeps its WAL segments in the JS heap (16 MiB each, allocated as a segment fills). Start on a fresh one,+ // so a segment boundary the earlier writes left nearby cannot count as heap the sweep holds.+ if (kind === 'pglite') { await engine.executeRaw('SELECT pg_switch_wal()'); await engine.executeRaw('CHECKPOINT'); }Bun.gc(true);const base = process.memoryUsage().heapUsed;let r: Awaited<ReturnType<typeof runMaintenanceSweep>>;