Skip to content

Memory not reclaimed after codex-cli exits in non-interactive mode #13314

@thingersoft

Description

@thingersoft

What version of Codex CLI is running?

0.106.0

What subscription do you have?

Azure OpenAI

Which model were you using?

gpt-5.1-codex

What platform is your computer?

Linux 5.14.0-503.22.1.el9_5.x86_64 x86_64 x86_64

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

No response

What issue are you seeing?

When running the codex-cli in non-interactive mode, memory used by the process is not reclaimed after shutdown.

In our case it's running inside a Debian-based Docker container (hosted on a RHEL VM) and repeating the process eventually exhausts memory and causes the sandbox container to be killed by OOM.

This appears to be a memory leak.

What steps can reproduce the bug?

Run codex-cli in non-interactive mode multiple times (example command):
codex exec --json --dangerously-bypass-approvals-and-sandbox {prompt}

What is the expected behavior?

After each codex-cli invocation exits, memory usage should return to the baseline (previous) free memory level.
Repeated runs should not accumulate unreleased memory.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIbugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions