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:
23
tests/scratch-cava-reinit.test.ts
Normal file
23
tests/scratch-cava-reinit.test.ts
Normal 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)
|
||||
Reference in New Issue
Block a user