Skip to content

zlib memory leak Node.js 24 #89091

@izorg

Description

@izorg

Link to the code that reproduces this issue

https://github.com/izorg/next-app

To Reproduce

  1. Use Node.js version 24.13.0
  2. npm run build
  3. NODE_OPTIONS=--inspect ./node_modules/.bin/next start
  4. Follow http://localhost:3000/
  5. Call GC & make memory snapshot
  6. Run snippet in browser console:
    const ATTEMPT_COUNT = 50
    const ATTEMPT_TIMEOUT_MS = 10
    const REQUEST_COUNT = 10
    const REQUEST_TIMEOUT_MS = 500
    
    for await (const attemptIndex of Array.from({ length: ATTEMPT_COUNT }).keys()) {
      for (const requestIndex of Array.from({ length: REQUEST_COUNT }).keys()) {
        fetch('http://localhost:3000/', {
          signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
        })
      }
    
      await new Promise((resolve) => {
        setTimeout(resolve, ATTEMPT_TIMEOUT_MS)
      })
    }
  7. Call GC & make memory snapshot
  8. Compare snapshots and see Node / zlib_memory positive delta

Current vs. Expected behavior

Expect memory to still more or less on the same level

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.2.0: Tue Nov 18 21:07:05 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T6020
  Available memory (MB): 32768
  Available CPU cores: 12
Binaries:
  Node: 24.13.0
  npm: 11.6.2
  Yarn: 1.22.22
  pnpm: 10.28.2
Relevant Packages:
  next: 16.1.5 // Latest available version is detected (16.1.5).
  eslint-config-next: N/A
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Performance

Which stage(s) are affected? (Select all that apply)

next start (local)

Additional context

I tested on 24.0.0 also, the issue is still there. I tested on lates 22.22.0 and there is no issue with zlib.

Metadata

Metadata

Assignees

No one assigned

    Labels

    PerformanceAnything with regards to Next.js performance.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions