Memory leak when running Python venv commands (pip show, pip list)

Status Closed — duplicate
Reported on v2.1.81
Maintainer reply None cached
Activity 3 comments · opened Mar 24, 2026 · closed Mar 28, 2026

Description

Claude Code leaks memory when running Python virtual environment commands like .venv/bin/pip show or .venv/bin/pip list through the Bash tool. The process eventually OOMs.

Steps to Reproduce

  1. Have a Python project with a .venv directory
  2. In Claude Code, run commands like:
  • .venv/bin/pip show <package>
  • .venv/bin/pip list
  • Or similar pip commands that produce output

Expected Behavior

Command output is captured without excessive memory consumption.

Actual Behavior

Memory usage grows unbounded, eventually causing the host process to OOM.

Workaround

Redirect output to a file and read it separately:

.venv/bin/pip show <package> > /tmp/pip-out.txt 2>&1

Environment

  • Claude Code version: 2.1.81
  • OS: Linux 6.17.0-19-generic x86_64
  • Shell: bash

View original on GitHub ↗

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