You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Memory usage grows very quickly when running commands with large output #9699
Simplest way to reproduce this is to run !find / and watch memory usage of the opencode processs. This happens both with the bash tool and with the interactive command. The memory usage grows at a much larger rate than you would expect from the command output.
The problem, I believe, is that we are constantly allocating strings, bigger and bigger ones, when we accumulate the output with string concatenation. That happens so quickly that the GC has little opportunity to catch up, leading to the very quick growth.
I bet it's one of the main issues people keep being bitten by when they see large memory usage issues, but I found no report specifically about the bash tool / interactive command buffer, so I am creating this one to associate with the pull request.
Plugins
No response
OpenCode version
git
Steps to reproduce
open opencode
!find /
watch memory usage over time
Screenshot and/or share link
Running !find /. I've seen it go all the way to almost 70% in some cases. I saw the OOM killer working overtime yesterday because of this. Had to add a new swap file just to get it through the task I was working on.
Activity
github-actions commentedon Jan 20, 2026
This issue might be a duplicate of existing issues. Please check:
These issues all report memory-related problems with large outputs. Feel free to ignore if none of these address your specific case.
fix: reduce memory usage in command output (anomalyco#9699)
thdxr commentedon Apr 2, 2026
Closing in favor of #20695 where we're collecting all memory-related problems. Please follow that issue for updates.