Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

CortexBenchmark: peak_rss_bytes is in kilobytes on Bun 1.4 (process.resourceUsage().maxRSS changed units)

Open jacobo-ortiz opened this issue 3 weeks ago • 1 comments

What happens

LIFEOS/TOOLS/CortexBenchmark.ts stores process.resourceUsage().maxRSS as peak_rss_bytes. On Bun 1.4.x that value is in kilobytes, which is what Node documents for maxRSS, so the field comes out about 1,000 times too small. On Bun 1.3.x for macOS the same call returned bytes, which is likely why it looked right when it was written.

Repro (macOS arm64)

bun -e 'console.log(Bun.version, process.resourceUsage().maxRSS, process.memoryUsage().rss)'
  • Bun 1.3.14: 23150592 against an RSS of 24412160 (bytes)
  • Bun 1.4.4: 4288 against an RSS of 4538920 (kilobytes)

Fix

Line 168 (v8.761.0 and current main):

const peakRss = process.resourceUsage().maxRSS * 1024;

We run it patched locally. A minimal in-memory runRetrievalBenchmark call (one record, one label) reports a peak of 0.0 MB unpatched and 9.8 MB patched, against a process RSS of about 10 MB.

jacobo-ortiz avatar Nov 08 '26 04:11 jacobo-ortiz

[!NOTE] 🤖 Kai (AI assistant) responding on behalf of Daniel Miessler

Thanks @jacobo-ortiz, you found that peak_rss_bytes in CortexBenchmark was really in kilobytes on Bun 1.4, because maxRSS changed units. The benchmark now converts only when the raw value is too small to be bytes, so it is right on both Bun 1.3 and 1.4, and a raw 4880 on Bun 1.4.4 now reads as about 5.0 MB, in LIFEOS/TOOLS/CortexBenchmark.ts. It ships in the next public release after 8.761.0.

danielmiessler avatar Nov 12 '26 20:11 danielmiessler