Skip to content

The Codex CLI has a serious memory leak issue that causes computer crashes. #9345

Closed

Description

@minorcell

What version of Codex is running?

codex-cli 0.84.0

What subscription do you have?

The codex CLI had a serious memory leak, which caused my computer to crash.

Which model were you using?

gpt-5.1-codex-max medium

What platform is your computer?

Darwin 25.2.0 arm64 arm

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

iTerm

What issue are you seeing?

Image

I'm using the Codex CLI to refactor a project. It seems there's a serious memory leak causing my computer to crash.

What steps can reproduce the bug?

How can I get CodeX to refactor a project?

What is the expected behavior?

No response

Additional information

No response

Activity

  1. changed the title [-]Severe memory leak[/-] [+]The Codex CLI has a serious memory leak issue that causes computer crashes.[/+] on Jan 16, 2026
  2. etraut-openai commented on Jan 16, 2026

    @etraut-openai
    Contributor

    Thanks for reporting.

    We haven't had other reports of such massive memory usage, but a memory leak is quite possible given the symptom you're seeing.

    Was this a really long session? Refactors often involve really long sessions.

  3. minorcell commented on Jan 16, 2026

    @minorcell
    Author

    Thanks for reporting.

    We haven't had other reports of such massive memory usage, but a memory leak is quite possible given the symptom you're seeing.

    Was this a really long session? Refactors often involve really long sessions.

    About twenty minutes into the task, I had the Codex CLI delete a large number of related files, approximately 1800.

  4. etraut-openai commented on Jan 16, 2026

    @etraut-openai
    Contributor

    Hmm, interesting. Twenty minutes is not very long. I was kind of expecting you to say "it's been running for 48 hours". :)

    Do you remember when you last launched codex? Did you start it right before that session, or has it been working on other sessions prior to that?

  5. minorcell commented on Jan 16, 2026

    @minorcell
    Author

    Hmm, interesting. Twenty minutes is not very long. I was kind of expecting you to say "it's been running for 48 hours". :)

    Do you remember when you last launched codex? Did you start it right before that session, or has it been working on other sessions prior to that?

    This is a new Codex CLI task I started in a fresh terminal. After restarting my computer, I tried to recover the session, but it seems the history wasn't saved—likely because of the physical reboot (though that’s a separate issue).

  6. etraut-openai commented on Jan 16, 2026

    @etraut-openai
    Contributor

    It looks like you're using iTerm as a terminal emulator. I guess we need to determine whether the memory leak is in Codex or in iTerm.

    What is your scrollback setting in iTerm? Is it unlimited? If so, that might explain the problem you're seeing.

  7. minorcell commented on Jan 16, 2026

    @minorcell
    Author

    It looks like you're using iTerm as a terminal emulator. I guess we need to determine whether the memory leak is in Codex or in iTerm.

    What is your scrollback setting in iTerm? Is it unlimited? If so, that might explain the problem you're seeing.

    I checked my iTerm profile settings — scrollback is limited to 1,000 lines
    (Unlimited scrollback is disabled).

    So it doesn’t look like an iTerm scrollback issue.
    Given that, this seems more likely to be memory retained by Codex itself
    (or a subprocess) during the large batch delete (~1800 files).

  8. minorcell commented on Jan 16, 2026

    @minorcell
    Author

    @etraut-openai

    This doesn’t happen very frequently, so it’s been hard to get a reliable repro so far.

    I’ll keep an eye on this going forward, and if it happens again, I’ll do my best to preserve detailed logs and report back.

    For reference, the operation that deleted ~1800 files corresponds to this commit:
    https://github.com/minorcell/Cap/commit/62858bb842d98a56a9c51486af90271f2e8be21d

  9. anthony-b-dev commented on Jan 17, 2026

    @anthony-b-dev

    Im having the same issue with the Vs Code extension. Instantly goes to 90% cpu, memory, and disk usage before crashing my whole computer a few minutes later. Spins up a nodejs runtime that hits 14 GB memory within a few seconds.

    Im in windows 11.

    Started with a prompt to explain a small section of my code and why it might be behaving a certain way

    Happens on extension version 0.4.58 and 0.4.60. No issues on 0.4.56

  10. etraut-openai commented on Jan 17, 2026

    @etraut-openai
    Contributor

    @anthony-b-dev, that isn't the same problem described by the OP of this issue. @minorcell is reporting a large memory usage with the CLI process running in iTerm. If you're seeing a large memory usage in a node process, that's something different. Please use the /feedback command to open a new bug report.

  11. AyinMostima commented on Jan 18, 2026

    @AyinMostima

    Yes, Codex deleted my entire F drive today, and it ran very slowly. I think there are serious problems with the development of the Codex product; both the CLI itself and the underlying concepts are extremely poor.

  12. minorcell commented on Jan 18, 2026

    @minorcell
    Author

    Yes, Codex deleted my entire F drive today, and it ran very slowly. I think there are serious problems with the development of the Codex product; both the CLI itself and the underlying concepts are extremely poor.

    Looks like this belongs to another thread?

  13. atimmer commented on Jan 19, 2026

    @atimmer

    I’m having the same issue with iTerm and codex CLI

  14. minorcell commented on Jan 19, 2026

    @minorcell
    Author

    I'm having the same issue with iTerm and codex CLI

    Have similar issues occurred on other devices?

  15. etraut-openai commented on Jan 19, 2026

    @etraut-openai
    Contributor

    @minorcell, you mentioned that your session involved many (1800) file deletions. Were these particularly large files (hundreds of MB)? If so, I think I have a working theory. If not, then I'm still grasping for more clues about what is special about your scenario. Have you seen this happen again, or was it just that one time?

    @atimmer, do you recall if your session involved any large file deletions? If not, are there any other details about your session that might be atypical? Are you also on macOS?

  16. atimmer commented on Jan 19, 2026

    @atimmer

    Have similar issues occurred on other devices?

    No, I also can also no longer reproduce it. The RAM usage right now is unremarkable.

    I did have heavy codex sessions on Friday and my battery was drained this morning. So perhaps it was a slow issue that occurred in the background.

    The other process with tons of RAM usage was Cursor. With 50GB. iTerm was on 200GB. I have installed iStatMenus with a notification on high RAM pressure, so maybe I catch it next time. If so, are there any diagnostics I can run to help debug the issue?

    do you recall if your session involved any large file deletions?

    Definitely not today. On Friday, I don't know. Yes, I'm on macOS.

  17. etraut-openai commented on Jan 19, 2026

    @etraut-openai
    Contributor

    @atimmer if you see this again, please use the /feedback slash command to upload your logs and session details, then post the thread ID here. @minorcell wasn't able to capture his logs or session details because his machine crashed before the logs were flushed to disk.

  18. minorcell commented on Jan 20, 2026

    @minorcell
    Author

    @minorcell, you mentioned that your session involved many (1800) file deletions. Were these particularly large files (hundreds of MB)? If so, I think I have a working theory. If not, then I'm still grasping for more clues about what is special about your scenario. Have you seen this happen again, or was it just that one time?

    @etraut-openai modified a total of 1884 files, with a total size of 45,405,611 bytes (approximately 43.30 MiB).

  19. jif-oai commented on Jan 20, 2026

    @jif-oai
    Contributor

    Do you have any /experimental features enable? Any MCPs connected?

  20. joshka-oai commented on Jan 20, 2026

    @joshka-oai
    Contributor

    Grab the version of your terminal (iTerm) for posterity (guessing probably 3.6.6, but could be 3.6.7 beta)

  21. etraut-openai commented on Jan 20, 2026

    @etraut-openai
    Contributor

    This should be fixed in the next release (this PR).

  22. minorcell commented on Jan 21, 2026

    @minorcell
    Author

    Grab the version of your terminal (iTerm) for posterity (guessing probably 3.6.6, but could be 3.6.7 beta)

    3.5.14

  23. minorcell commented on Jan 21, 2026

    @minorcell
    Author

    Do you have any /experimental features enable? Any MCPs connected?

    shadcn and supabase mcp.

  24. tommy-tai commented on Feb 1, 2026

    @tommy-tai

    been running into a similar experience:

    $ codex --version
    codex-cli 0.93.0
    
  25. etraut-openai commented on Feb 1, 2026

    @etraut-openai
    Contributor

    @tommy-tai , this issue has been addressed. If you are seeing a similar symptom, please open a new issue and provide details including repro steps if possible.

  26. locked as resolved and limited conversation to collaborators on Feb 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions