{"record":{"id":"e8f9f7b94cc30ca1","repo":"vercel/next.js","slug":"long-running-gc-detected-entry-duration-tofixed","errorCode":null,"errorMessage":"Long running GC detected: ${entry.duration.toFixed(2)}ms","messagePattern":"Long running GC detected: (.+?)ms","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/next/src/lib/memory/gc-observer.ts","lineNumber":13,"sourceCode":"import { PerformanceObserver } from 'perf_hooks'\nimport { warn } from '../../build/output/log'\nimport { bold } from '../picocolors'\n\nconst LONG_RUNNING_GC_THRESHOLD_MS = 15\n\nconst gcEvents: PerformanceEntry[] = []\nconst obs = new PerformanceObserver((list) => {\n  const entry = list.getEntries()[0]\n  gcEvents.push(entry)\n\n  if (entry.duration > LONG_RUNNING_GC_THRESHOLD_MS) {\n    warn(bold(`Long running GC detected: ${entry.duration.toFixed(2)}ms`))\n  }\n})\n\n/**\n * Starts recording garbage collection events in the process and warn on long\n * running GCs. To disable, call `stopObservingGc`.\n */\nexport function startObservingGc() {\n  obs.observe({ entryTypes: ['gc'] })\n}\n\nexport function stopObservingGc() {\n  obs.disconnect()\n}\n\n/**\n * Returns all recorded garbage collection events. This function will only\n * return information from when `startObservingGc` was enabled and before","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/vercel/next.js/blob/0eb377541648e63402a47b38fee00a8d0ce8f8f1/packages/next/src/lib/memory/gc-observer.ts#L1-L31","documentation":"The gc-observer PerformanceObserver records every GC event and warns when a garbage-collection pause exceeds LONG_RUNNING_GC_THRESHOLD_MS (15ms), since long pauses signal memory pressure hurting dev/build performance; observation continues afterwards.","triggerScenarios":"Thrown at packages/next/src/lib/memory/gc-observer.ts:13 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Investigate memory pressure in the Node process; consider increasing heap size (--max-old-space-size) or reducing retained objects."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0eb377541648e63402a47b38fee00a8d0ce8f8f1","analyzedAt":"2026-08-19T02:10:13.922Z","contentChangedAt":"2026-08-19T02:10:13.922Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}