{"record":{"id":"ef5d0fd3a14af67b","repo":"oven-sh/bun","slug":"this-benchmark-needs-a-gc-hook-run-with-bun-or-n-ef5d0f","errorCode":null,"errorMessage":"This benchmark needs a GC hook: run with Bun, or node --expose-gc.","messagePattern":"This benchmark needs a GC hook: run with Bun, or node --expose-gc\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"bench/snippets/webstreams-tee.mjs","lineNumber":8,"sourceCode":"// tee()/clone() throughput and memory: plain ReadableStream.tee, fetch Response.clone,\n// and Bun.serve Request.clone. Reports MB/s over the total bytes moved plus peak/settled\n// RSS growth for each scenario (best-of-RUNS for time; max for memory).\nconst RUNS = 3;\nconst MB = 1024 * 1024;\nconst CHUNK = new Uint8Array(64 * 1024).fill(120);\nconst gc = globalThis.Bun?.gc ?? globalThis.gc;\nif (!gc) throw new Error(\"This benchmark needs a GC hook: run with Bun, or node --expose-gc.\");\nconst rss = () => process.memoryUsage.rss();\nconst fmt = n => (n / MB).toFixed(1).padStart(7) + \" MB\";\n\nconst source = totalBytes => {\n  const count = Math.ceil(totalBytes / CHUNK.length);\n  let i = 0;\n  return new ReadableStream({\n    pull(c) {\n      if (i++ < count) c.enqueue(CHUNK);\n      else c.close();\n    },\n  });\n};\nconst drain = async rs => {\n  const r = rs.getReader();\n  let n = 0;\n  while (true) {\n    const { done, value } = await r.read();","sourceCodeStart":1,"sourceCodeEnd":26,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/bench/snippets/webstreams-tee.mjs#L1-L26","documentation":"Error \"This benchmark needs a GC hook: run with Bun, or node --expose-gc.\" thrown in oven-sh/bun.","triggerScenarios":"Thrown at bench/snippets/webstreams-tee.mjs:8 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}