[BUG] TUI Terminal overflow causes memory leaks resulting in application failure

Resolved 💬 5 comments Opened Oct 18, 2025 by fye-admin Closed Jan 10, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

There are similar reports to this, however I don't think that anyone is properly identifying what is causing this bug. Typically you'll see whenever claude code has a history of edits, that new tasks that will edit files or tool usage to edit files or scrolling up when there are edits on previous files will cause claude code to glitch back and forth rapidly. The screen will flicker back and forth so much that it looks like it can cause a seizure. I tried to narrow down what is causing this, however it happens whether or not claude code is actively working or not. I recently tried scrolling up to see past messages when claude had stopped responding. This time the flickering caused the app claude code was loaded in to force quit. Most of the time, its when a task or tool is operating but it was strange to me that this time claude was not operating at all. You can also see this bug by reducing the size of the terminal window while there are edits in the conversation.

The intuition behind the bug is as follows:

  1. Some bounded height constraint in TUI is artificially imposed as the terminal cannot handle the unbounded height of the conversation content properly.
  2. The bounded content height being breached by new content results in a memory leakage. When the memory leakage reaches critical mass (whether claude is operating or not) the app containing the terminal force quits.

I have experienced force quits in applications such as Cursor, VSCode, and multiple independent terminals dealing with this issue. The memory leak builds over time as the bounded height problem is continuously triggered. This seems to come from some buffer overload imposed by how the TUI is handled when this height constraint is breached.

What Should Happen?

Claude code should be able to operate without a TUI imposed bounded height constraint as the core functionality requires new content to continuously be produced. This doesn't mean conversations can't be truncated to show past a certain limit. This is entirely separate from a UI imposed bug that cannot handle content surpassing a certain amount. You can also see this bug by reducing the size of the terminal window while there are edits in the conversation. Claude does not have to be running for this frantic buffer overload behavior to occur.

Error Messages/Logs

Claude quits without any logs

Steps to Reproduce

Wait until claude does multiple edits on a large file, the flickering of the UI is imminent. If multiple edits have been made, you can view this when scrolling up. You can also see this by reducing the side of the terminal while there are a lot of edits in the conversation. Once this occurs for enough time, the memory will swell up causing the encapsulating application to crash

Claude Model

Sonnet (default)

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.0.22

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Cursor

Additional Information

This is a TUI imposed problem, not an issue on how Claude code operates. This issue will show itself whether or not Claude is in operation and a user is just scrolling through the conversation with a lot of edits. The TUI buffer overflow builds over time.

Related issues are here but don't explain the source of the bug :

https://github.com/anthropics/claude-code/issues/8618
https://github.com/anthropics/claude-code/issues/8097
https://github.com/anthropics/claude-code/issues/7793
https://github.com/anthropics/claude-code/issues/5276
https://github.com/anthropics/claude-code/issues/3648
https://github.com/anthropics/claude-code/issues/2537
https://github.com/anthropics/claude-code/issues/9873
https://github.com/anthropics/claude-code/issues/8983
https://github.com/anthropics/claude-code/issues/2118
https://github.com/anthropics/claude-code/issues/9672

View original on GitHub ↗

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