fix: bound process output memory and HTTP request bodies
This commit is contained in:
1 parent
b96dfad692
commit
e3af094fb4
8 files changed
+259
-54
No files matched your search
@@ -0,0 +1,13 @@
|
||||
import { runShell } from "../src/helpers";
|
||||
|
||||
// Isolated synthetic producer. No NAS, network access or host file content.
|
||||
const mib = Number(process.argv[2] ?? 64);
|
||||
if (!Number.isInteger(mib) || mib < 1 || mib > 128) throw new Error("Use 1..128 MiB");
|
||||
const before = process.memoryUsage();
|
||||
const result = JSON.parse(await runShell(`head -c ${mib * 1024 * 1024} /dev/zero | tr '\\000' x`, 30));
|
||||
const after = process.memoryUsage();
|
||||
Bun.gc(true);
|
||||
console.log(JSON.stringify({
|
||||
runtime: Bun.version, produced_mib: mib, returned_chars: result.stdout.length,
|
||||
truncated: result.truncated ?? null, before, after, after_gc: process.memoryUsage(),
|
||||
}));
|
||||
Reference in new issue
Block a user