vercel/next.js · error

Received SIGUSR2 signal. Generating heap snapshot. Note: thi

Error message

Received SIGUSR2 signal. Generating heap snapshot. Note: this will take some time.

What it means

In enableMemoryDebuggingMode, a SIGUSR2 handler is registered so a V8 heap snapshot can be triggered on demand; it warns that writing the snapshot is slow before performing it. Part of Next.js memory debugging instrumentation, not an error.

Source

Thrown at packages/next/src/lib/memory/startup.ts:23

import { startPeriodicMemoryUsageTracing } from './trace'

export function enableMemoryDebuggingMode(): void {
  // This will generate a heap snapshot when the program is close to the
  // memory limit. It does not give any warning to the user though which
  // can be jarring. If memory is large, this may take a long time.
  if ('setHeapSnapshotNearHeapLimit' in v8) {
    v8.setHeapSnapshotNearHeapLimit(1)
  }

  // This flag will kill the process when it starts to GC thrash when it's
  // close to the memory limit rather than continuing to try to collect
  // memory ineffectively.
  v8.setFlagsFromString('--detect-ineffective-gcs-near-heap-limit')

  // This allows users to generate a heap snapshot on demand just by sending
  // a signal to the process.
  process.on('SIGUSR2', () => {
    warn(
      `Received SIGUSR2 signal. Generating heap snapshot. ${italic(
        'Note: this will take some time.'
      )}`
    )
    v8.writeHeapSnapshot()
  })

  startObservingGc()
  startPeriodicMemoryUsageTracing()

  warn(
    `Memory debugging mode is enabled. ${italic(
      'Note: This will affect performance.'
    )}`
  )
  info(
    ' - Heap snapshots will be automatically generated when the process reaches more than 70% of the memory limit and again when the process is just about to run out of memory.'
  )

View on GitHub (pinned to 0eb3775416)

Solutions

  1. Wait for the heap snapshot to finish; it is written to the indicated file for analysis.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at packages/next/src/lib/memory/startup.ts:23 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of vercel/next.js@0eb3775416 (2026-08-19). Data as JSON: /api/errors/e3c2eeff71e5b1cf. Report an issue: GitHub.