Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/Aquaticat/Monochromatic. TypeScript and Rust monorepo: Claude Code and Pi coding-agent plugins, a m
Something went wrong. Try again.
123456789101112131415161718192021222324252627import { BYTES_PER_MIB, } from '@monochromatic-dev/module-const/ts';
/** Number of mebibytes per allocation chunk: large enough to exhaust memory in a few iterations. */const CHUNK_SIZE_MIB = 256;
/** Size of each allocation in bytes. */const CHUNK_SIZE_BYTES = CHUNK_SIZE_MIB * BYTES_PER_MIB;
/** Intentionally triggers an out-of-memory crash by pushing 256 MB `Buffer` chunks into an array without releasing them, until the process runs out of heap space. */const chunks: Buffer[] = [];
for (;;) { chunks.push(Buffer.alloc(CHUNK_SIZE_BYTES,),); console.log(`Allocated ${chunks.length * CHUNK_SIZE_MIB} MB`,);}