test(scratch): leak-hunt probes for cava, render loop, decode stream

One-off diagnostics behind the FFTW leak fix: init/destroy x50 RSS
bound, Mach VM region walker, render-churn region growth, ffmpeg
decode-stream region/rss sampling.
This commit is contained in:
2026-09-06 18:46:42 -04:00
parent 6c3ad5d925
commit b53d4add29
5 changed files with 142 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
/** Scratch: cava init/destroy cycles leak native fftw buffers? */
import { test, expect } from "bun:test"
import { loadCavaCore } from "../src/utils/cavacore"
const cava = loadCavaCore()
const skip = !cava
test.skipIf(skip)("init/destroy x50: RSS bounded", () => {
const cfg = { bars: 64, sampleRate: 22050, channels: 1, autosens: 0 }
const samples = new Float64Array(8192)
Bun.gc(true)
const startRss = process.memoryUsage.rss()
for (let i = 0; i < 50; i++) {
cava!.init(cfg)
cava!.execute(samples)
cava!.destroy()
}
Bun.gc(true)
const endRss = process.memoryUsage.rss()
const grown = (endRss - startRss) / 1048576
console.log(`init/destroy x50: rss delta=${grown.toFixed(1)}MB`)
expect(grown).toBeLessThan(100)
}, 60_000)