oven-sh/bun · error · Error

This benchmark needs a GC hook: run with Bun, or node --expo

Error message

This benchmark needs a GC hook: run with Bun, or node --expose-gc.

What it means

Error "This benchmark needs a GC hook: run with Bun, or node --expose-gc." thrown in oven-sh/bun.

Source

Thrown at bench/snippets/webstreams-tee.mjs:8

// tee()/clone() throughput and memory: plain ReadableStream.tee, fetch Response.clone,
// and Bun.serve Request.clone. Reports MB/s over the total bytes moved plus peak/settled
// RSS growth for each scenario (best-of-RUNS for time; max for memory).
const RUNS = 3;
const MB = 1024 * 1024;
const CHUNK = new Uint8Array(64 * 1024).fill(120);
const gc = globalThis.Bun?.gc ?? globalThis.gc;
if (!gc) throw new Error("This benchmark needs a GC hook: run with Bun, or node --expose-gc.");
const rss = () => process.memoryUsage.rss();
const fmt = n => (n / MB).toFixed(1).padStart(7) + " MB";

const source = totalBytes => {
  const count = Math.ceil(totalBytes / CHUNK.length);
  let i = 0;
  return new ReadableStream({
    pull(c) {
      if (i++ < count) c.enqueue(CHUNK);
      else c.close();
    },
  });
};
const drain = async rs => {
  const r = rs.getReader();
  let n = 0;
  while (true) {
    const { done, value } = await r.read();

View on GitHub (pinned to 8c5296ac45)

When it happens

Trigger: Thrown at bench/snippets/webstreams-tee.mjs:8 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16). Data as JSON: /api/errors/ef5d0fd3a14af67b. Report an issue: GitHub.