Codex memory grows to 75GB+ during basic session

Open 💬 5 comments Opened May 2, 2026 by evilfps

Summary

Urgent: Codex can grow to extreme memory usage during an apparently basic/single-task session, eventually triggering macOS "Your system has run out of application memory."

Observed in the macOS Force Quit Applications dialog:

Codex: 75.50 GB
cmux (paused): 10.76 GB
Activity Monitor: 60.4 MB
Finder: 125.9 MB

The memory usage reportedly kept increasing and reached roughly 85 GB before Codex was stopped to avoid taking down the system.

Environment

  • Codex CLI: codex-cli 0.128.0
  • OS: macOS 26.4.1, Darwin 25.4.0, arm64
  • Model: gpt-5.5
  • Reasoning effort: medium
  • Config has multi_agent = true, but the observed problem happened during a basic/single-task session, not an intentionally large multi-agent run.

Impact

This is system-threatening on macOS:

  • macOS showed the global "system has run out of application memory" dialog.
  • Codex reached at least 75.50 GB in the Force Quit dialog.
  • The user had to stop Codex manually when it approached roughly 85 GB and was still increasing.
  • This can interrupt work and risks destabilizing the whole machine.

What happened

During a normal Codex session, memory usage climbed continuously even though the user was not running a large task. The behavior looked like runaway accumulation/leak rather than a bounded memory spike.

Relevant local log clue from the same timeframe:

turn{... model=gpt-5.5 codex.turn.token_usage.input_tokens=1905121 ... codex.turn.token_usage.cached_input_tokens=1818240 ... codex.turn.token_usage.non_cached_input_tokens=86881 ... codex.turn.token_usage.output_tokens=3950 ... codex.turn.token_usage.reasoning_output_tokens=1091 ... codex.turn.token_usage.total_tokens=1909071}: codex_core::tasks: close time.busy=1.18s time.idle=361s

That is about 1.9M total tokens for a session that did not feel like a large task from the user's perspective. This may indicate that Codex is retaining/re-sending/accumulating too much session context or cached input state across turns, which may correlate with the memory growth.

Expected behavior

For a basic single-task session, Codex memory should remain bounded and should not grow into tens of GB. If a session/context grows unexpectedly large, Codex should either compact, evict, fail fast with a clear diagnostic, or provide an explicit warning before the desktop app threatens system memory.

Actual behavior

Codex memory kept increasing until macOS forced the user into the application memory pressure dialog. Codex was shown at 75.50 GB and was reportedly near 85 GB before the user stopped it.

Notes

This may be related to a separate WebSocket/Responses streaming instability issue already filed here:

However, this issue is distinct: the urgent failure here is unbounded memory growth / excessive retained context during ordinary usage.

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗