Repository navigation
Codex Desktop on Windows retains/increases memory after opening long tool-heavy thread; memory not released after turns finish #26015
Description
Summary
Codex Desktop on Windows appears to retain and/or continue increasing memory usage after opening a long, tool-heavy thread. The system remains stable when Codex is not running, and also mostly stable when Codex is open but no heavy thread is opened. Opening a large existing conversation causes memory usage to jump and then continue rising; memory is not released after the turn/conversation activity ends.
This looks related to loading/rendering/resuming long thread history with many tool calls / shell outputs / monitoring turns in the Desktop WebView/renderer/app-server path.
Environment
- OS: Windows 11
- Codex Desktop package observed in process path:
OpenAI.Codex_26.601.2237.0_x64__2p2nqsd0c76g0 - Workspace: local Windows project
- Machine memory: ~16 GB RAM (
TotalVisibleMemorySizeabout 15.19 GB) - Affected surface: Codex Desktop app, Windows
Reproduction / A-B observations
- Reboot machine.
- Do not start Codex. Observe memory for ~20 minutes.
- Memory remains stable around 40%.
- Start Codex Desktop but do not open/operate any heavy conversation.
- Memory remains stable around 45%.
- Open a long existing conversation containing many tool calls, shell outputs, monitoring/waiting turns, and thread-history diagnostics.
- Memory immediately increases to about 52%.
- Without heavy new work, it continues rising to 55%+.
- Continuing long-running monitoring-style turns eventually pushes memory much higher, up to 90-99%.
- Ending a turn does not return memory to the previous baseline. Closing/restarting Codex is the only reliable way observed to reclaim the memory.
Concrete diagnostics observed
When memory was healthy after reboot / light Codex usage:
Codex closed: stable around 40%
Codex open but idle: stable around 45%
After opening the long thread:
Memory jumped to ~52%, then kept rising to ~55%+
During higher-pressure cases with active long monitoring/tool turns:
UsedPct: 88-99%
Available memory: dropped as low as ~13 MB in one snapshot
Standby/cache: compressed down near zero in worst cases
Representative snapshot while pressure was high:
UsedPct: 99.1%
AvailableMB: 13
StandbyGB: 0.01
CacheGB: 0.03
NonpagedGB: ~1.92
PagedGB: ~1.19
CommitGB: ~28.78 / 53.19
Another case after restarting and reproducing by opening/using the long thread:
UsedPct: 88.4%
AvailableMB: 1875
StandbyGB: 1.74
CommitGB: 22.67 / 53.19
Process groups were not individually huge, but Codex/WebView/thread history was consistently involved:
Codex: roughly 1.0-1.1 GB Private across multiple processes
msedgewebview2: roughly 0.8-0.9 GB Private across many processes
Long thread token counters: tens of millions on affected histories
Rollout files: several MB with hundreds of tool calls and outputs
The problematic thread pattern includes:
- Long-lived Desktop threads
- Many
shell_commandcalls - Monitoring/waiting loops (
continue monitoring progress, waiting for remote training epochs, reading logs/history repeatedly) - Many tool outputs, some truncated near ~40 KB
- Thread continuation / summarization chains
- Large accumulated
tokens_usedvalues, e.g. affected histories reaching tens of millions of accumulated tokens
Expected behavior
- Opening a long thread may temporarily use extra memory, but memory should stabilize and/or be released after the thread is no longer active.
- Ending a turn should not leave Desktop/WebView/app-server memory permanently elevated.
- Long tool histories should be virtualized / unloaded / garbage-collected so that opening or leaving a thread does not keep increasing system memory pressure.
Actual behavior
- Opening the long thread immediately raises memory usage.
- Staying in the long thread or running additional monitoring-style turns causes memory to continue rising.
- After turns finish, memory is not released back near the pre-open baseline.
- Reopening/continuing long threads amplifies the issue.
- Restarting Codex releases the memory, suggesting retained renderer/session/tool-history state rather than system-wide baseline pressure alone.
Additional notes
I also tested whether this was caused by unrelated system software. After reboot, with Codex closed, memory stayed stable around 40% for ~20 minutes. That makes a pure system-driver leak less likely. GPU overlays / AMD / Lenovo background tools may add pressure, but the cleanest A/B trigger is opening the heavy Codex thread.
This may be a Desktop/WebView memory-retention issue around long conversation history, tool output rendering, stream/log retention, or thread/session state not being released after turns complete.
Activity
github-actions commentedon Jun 3, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Duhl-Liamz commentedon Jun 3, 2026
Additional diagnostics from RAMMap / follow-up testing:
RAMMap evidence
After reproducing the memory growth, Windows Task Manager showed high "In use" memory, but the top processes did not explain it. RAMMap provided a clearer breakdown:
The important part is that Page Table was around 3 GB, while Driver Locked was only ~181 MB and Process Private was not large enough to explain the high physical memory usage.
RAMMap
Processestab sorted byPage Tabledid not show any individual process with a large page table footprint. The largest visible entries were only a few MB, for example:So the Page Table growth does not appear attributable to one currently-running process. It looks more like accumulated/system-level page table memory after a long tool-heavy Codex Desktop session.
RAMMap Empty test
I then ran:
This reduced memory usage only partially, down to about 80%, but did not return the system to the post-reboot baseline of about 40-45%. This suggests there are two components:
Updated hypothesis
Codex creating many child processes is expected behavior for tool-heavy sessions. During long sessions it naturally creates many short-lived processes such as:
The suspected bug is not that these subprocesses are created. The suspected bug is that after many tool calls / short-lived subprocesses / WebView-heavy thread-history operations, Page Table memory grows to GB scale and does not return to baseline after the subprocesses exit or Codex is closed.
A more precise formulation of the issue:
This also explains why regular Task Manager process memory did not add up to the total physical memory usage.
Duhl-Liamz commentedon Jun 5, 2026
Additional reproduction update:
After more A/B testing, the trigger appears broader than just opening/resuming a very long thread.
New observation:
Updated interpretation:
The earlier long-thread/session-history hypothesis is still relevant, but the immediate trigger may be the Desktop task execution path itself: app-server/tool execution/subprocess/WebView state created during active turns. Large historical threads likely increase the amount of state and tool output involved, but the memory blow-up can also occur during ordinary active tasks.
This makes the issue more severe than initially described: the system can stay stable while Codex is idle, then become unstable after task execution begins, regardless of whether the thread is especially long.
The RAMMap observations from the previous comment remain important: the unexplained memory is not accounted for by normal Process Private usage, and Page Table/system memory can remain high after Codex/task activity ends.
Photosounder commentedon Jul 11, 2026
I have this too and it took me days to figure out what the culprit was, I just figured it out through wprui and leave Codex open not doing anything (somehow it called git.exe a lot regardless). I would progressively get up to 7 GB of non-paged memory in about 3 days with no recourse other than a reboot, whereas I would normally leave my machine up for weeks.
Quick rant: OpenAI has unlimited access to ChatGPT 6.0, they could probably fix this easily, if anyone in the world can fix such bugs easily it's them because they have the tech. Yet here we are, having to reboot our computers regularly because of an app.
aujurd22 commentedon Aug 4, 2026
Additional Windows reproduction on a newer desktop build.
Environment:
Reproduction:
codex.exeapp-server process.codex.exe -c features.code_mode_host=true app-server --analytics-default-enabled.Observed behavior:
codex.exeprivate memory reached approximately 16.77 GiB and working set reached approximately 16.79 GiB.codex.exeused approximately 0.05 GiB private memory / 0.11 GiB working set.Session-size evidence:
This suggests that resuming/loading a large historical rollout can cause severe app-server memory amplification or retention. The exact allocator/root cause is unknown, but this is reproducible as continuous private-memory growth in the Codex app-server and is not normal system cache behavior.
Expected:
Opening a long conversation may temporarily use additional memory, but memory should remain bounded and the app should not consume most of a 32 GB system.
No raw ERP transcript, project files, credentials, or customer data are attached.