Codex Desktop reaches 130 GB memory during Ultra multi-agent swarm (24 GB Mac)

Open 💬 2 comments Opened Jul 15, 2026 by a861252012
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex CLI is running?

codex-cli 0.144.2, bundled with ChatGPT/Codex Desktop 26.707.72221 (build 5307).

What subscription do you have?

ChatGPT subscription; exact tier not confirmed.

Which model were you using?

The app displayed 5.6 Sol with reasoning effort set to Very High (超高).

What platform is your computer?

Darwin 25.5.0 arm64 arm; macOS 26.5.2 (build 25F84), Apple Silicon, 24 GB physical memory.

What terminal emulator and version are you using (if applicable)?

ChatGPT/Codex Desktop app; no external terminal multiplexer was involved in the incident.

Codex doctor report

Uploaded privately with /feedback, together with the Codex logs and rollouts. Uploaded thread ID: 019f66b5-4768-7153-acb6-0357747632c2.

What issue are you seeing?

During an Ultra multi-agent workload, Codex Desktop consumed 130.58 GB according to the macOS "system has run out of application memory" dialog on a Mac with 24 GB of physical memory.

The incident occurred at approximately 2026-07-16 00:49 Asia/Taipei. macOS began killing idle daemons and purging caches at around 00:48. After restarting ChatGPT/Codex Desktop at 00:56, the total RSS of its process group returned to approximately 2.23 GB, and memory_pressure reported approximately 81% free system memory. This strongly suggests the extreme usage belonged to the app/session rather than ordinary baseline system use.

Local diagnostics for approximately 00:20–00:49 showed:

  • 328 logged spawn_agent tool calls
  • 386 distinct thread IDs
  • 115,142 log rows totaling approximately 890.5 MB in that window
  • rmcp::service dominated the log volume
  • ~/.codex/logs_2.sqlite had grown to approximately 2.9 GB
  • ~/.codex/sessions occupied approximately 4.4 GB

The original macOS application-memory screenshot is included in the uploaded rollout. Raw logs are not posted publicly because they contain local paths, prompts, and project metadata.

What steps can reproduce the bug?

  1. Open ChatGPT/Codex Desktop on a 24 GB Apple Silicon Mac.
  2. Use the app's Ultra multi-agent capability with the displayed 5.6 Sol model and Very High reasoning effort.
  3. Run a long task that fans out into many subagents and allow the workload to continue for roughly 30 minutes.
  4. In this incident, the diagnostics recorded 328 spawn_agent calls and 386 distinct thread IDs.
  5. Observe memory growth until macOS displays the global application-memory exhaustion dialog; ChatGPT reached 130.58 GB here.

This is one observed incident rather than a minimal deterministic reproducer. The uploaded logs should contain the exact timeline.

What is the expected behavior?

Codex Desktop should enforce bounded local memory and concurrency for Ultra agent swarms. Completed or idle agent/thread state and log batches should be compacted, evicted, or backpressured. If the workload approaches a system-safe limit, the app should stop spawning agents or fail with a clear warning before macOS reaches global memory exhaustion.

Additional information

The /feedback upload completed successfully and included:

  • codex-logs.log
  • Codex doctor report
  • current rollout containing the screenshot
  • auto-review rollout

Uploaded thread ID: 019f66b5-4768-7153-acb6-0357747632c2.

Possibly related, but the trigger and evidence differ:

  • openai/codex#20740 reports 75 GB+ growth during a basic/single-task session.
  • openai/codex#26869 reports stale child processes and excessive log writes after a crash/restart.
  • openai/codex#12491 reports unreaped MCP child processes and a 37 GB leak.

This report specifically captures active Ultra multi-agent fan-out, hundreds of threads, very high log volume, and a peak of 130.58 GB. I do not yet have enough evidence to claim the same root cause as those issues.

View original on GitHub ↗

2 Comments

github-actions[bot] contributor · 1 month ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #33319
  • #33368

Powered by Codex Action

lubluniky · 1 month ago

I hit what appears to be the same failure class on another 24 GB Apple Silicon Mac, with additional post-incident evidence that may help narrow the trigger.

Observed impact

  • macOS 26.5, build 25F5053d
  • 24 GB physical RAM
  • Force Quit reported 106.92 GB for ChatGPT/Codex
  • Other applications were using roughly another 15 GB
  • macOS remained alive long enough to present the global “out of application memory” dialog and let me force-quit Codex. Memory compression and swap appear to have absorbed an extraordinary amount of pressure before the app finally became untenable.
  • After force-quitting and restarting Codex, memory returned to normal.

Parent-thread evidence

The likely trigger was one unusually large lead thread:

  • 119 context windows
  • 95 task starts
  • 24 context compactions
  • 32 spawn_agent calls
  • 2,232 code-mode execution records
  • 747 regular tool calls
  • 44 related rollout files totaling approximately 263 MB

The important timing evidence is that three children belonging to this parent were restored/spawned almost simultaneously shortly before the OOM:

01:41:34 UTC  /root/pr23_reconcile
01:41:41 UTC  /root/pr25_reconcile
01:41:49 UTC  /root/pr28_ops

Each child’s session metadata directly identifies the same parent thread. Each also received a guardian session. The three main child rollouts rapidly reached approximately 19.6 MB, 21.6 MB, and 19.5 MB.

These children had originally been created with fork_turns: "all", so they inherited the very large lead-thread history. This suggests a possible restore/resume amplification path: several full-history agents are hydrated concurrently, each resumes repository/tool state, and resource use is not backpressured against available system memory.

Process evidence

The macOS unified log also shows a large burst of short-lived descendants associated with the ChatGPT/Codex process tree, including repeated git, bash, and node processes. Groups of Git operations appeared repeatedly, including git add -u and git status activity.

The kernel repeatedly logged messages of this form for the spawned processes:

triggered unnest of range ... of DYLD shared region in VM map ...
While not abnormal for debuggers, this increases system memory footprint
almost permanently (until the shared region is re-slid).

This may explain why the value attributed to the ChatGPT application coalition grew far beyond physical RAM: the failure was not necessarily a single renderer heap reaching 106.92 GB, but an aggregate coalition/VM footprint amplified by extreme child-process churn, compressed memory, and swap.

There may be overlap with #29084’s unbounded desktop Git watcher, although this workspace did not yet receive the same nested-repository negative-control testing. In this incident, the strongest direct trigger is concurrent restoration of several very large fork_turns: all subagents, followed by process churn.

Suggested safeguards

  • Bound concurrent restore/hydration of subagents by memory budget.
  • Avoid eagerly duplicating or hydrating complete parent history for every restored child.
  • Apply backpressure before restoring guardians, MCP runtimes, and repository watchers for several children at once.
  • Debounce and cap concurrent Git/checkpoint subprocesses.
  • Surface a recoverable warning and pause agent restoration before system-wide memory exhaustion.
  • Record per-thread/per-agent RSS, child count, restore reason, and coalition footprint so future reports can identify the owning component directly.

I am happy to provide sanitized unified-log excerpts or the exact parent thread ID privately if that would help. I use Codex heavily and am reporting this because I would genuinely like to help make the multi-agent workflow more robust.