Uses a huge amount of memory #1988

Open
opened 2026-02-16 17:33:35 -05:00 by yindo · 28 comments
Owner

Originally created by @honbolau on GitHub (Oct 7, 2025).

Originally assigned to: @thdxr, @rekram1-node on GitHub.

When I use AI extensively in a session, opencode's memory usage will keep increasing until it gets stuck.

Image
Originally created by @honbolau on GitHub (Oct 7, 2025). Originally assigned to: @thdxr, @rekram1-node on GitHub. When I use AI extensively in a session, opencode's memory usage will keep increasing until it gets stuck. <img width="1920" height="1280" alt="Image" src="https://github.com/user-attachments/assets/c8a76c66-ba47-4b6f-a69f-f2cbacaa24b7" />
yindo added the badbugperf labels 2026-02-16 17:33:36 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Oct 7, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #2805: High RAM usage in latest release - Reports unusually high memory consumption with Bun runtime after recent updates
  • #2585: Massive memory use on opening opencode when there is a very large file - Reports 29GB RAM usage and slow computer performance, similar memory consumption pattern
  • #811: Text rendering is VERY slow (and CPU usage is really high even when idle) - Reports high CPU usage (25-30% when idle, 200-300% when active) along with performance issues
  • #496: Absurd amount of cpu and memory usage when doing path completion - Reports 100% CPU and memory usage, described as "like a forkbomb"
  • #731: Critical Stability Issues - Comprehensive analysis that includes memory-related stability issues and app freezing

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Oct 7, 2025): This issue might be a duplicate of existing issues. Please check: - #2805: High RAM usage in latest release - Reports unusually high memory consumption with Bun runtime after recent updates - #2585: Massive memory use on opening opencode when there is a very large file - Reports 29GB RAM usage and slow computer performance, similar memory consumption pattern - #811: Text rendering is VERY slow (and CPU usage is really high even when idle) - Reports high CPU usage (25-30% when idle, 200-300% when active) along with performance issues - #496: Absurd amount of cpu and memory usage when doing path completion - Reports 100% CPU and memory usage, described as "like a forkbomb" - #731: Critical Stability Issues - Comprehensive analysis that includes memory-related stability issues and app freezing Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Oct 7, 2025):

yeah current performance leaves a LOT to be desired, we are currently rewriting tui and it should be done this week most likely. It will have a lot of performance improvements.

@rekram1-node commented on GitHub (Oct 7, 2025): yeah current performance leaves a LOT to be desired, we are currently rewriting tui and it should be done this week most likely. It will have a lot of performance improvements.
Author
Owner

@veracioux commented on GitHub (Oct 8, 2025):

Not sure if relevant to this issue, but one thing I have noticed is that when I run a debugger and either the server or the TUI stays paused on a breakpoint for a while, I would run out of memory on my system within a minute.

I'm guessing this might be because of messages queuing up and/or this code: https://github.com/sst/opencode/blob/c93c0d402d3130c6e69129395993ac1776132234/packages/opencode/src/server/tui.ts#L12

@veracioux commented on GitHub (Oct 8, 2025): Not sure if relevant to this issue, but one thing I have noticed is that when I run a debugger and either the server or the TUI stays paused on a breakpoint for a while, I would run out of memory on my system within a minute. I'm guessing this might be because of messages queuing up and/or this code: https://github.com/sst/opencode/blob/c93c0d402d3130c6e69129395993ac1776132234/packages/opencode/src/server/tui.ts#L12
Author
Owner

@dkmnx commented on GitHub (Oct 16, 2025):

I'm also experiencing this with v0.15.3.

@dkmnx commented on GitHub (Oct 16, 2025): I'm also experiencing this with `v0.15.3`.
Author
Owner

@rekram1-node commented on GitHub (Oct 16, 2025):

@dkmnx what kind of project is it? Perhaps lsp servers are eating up the memory

@rekram1-node commented on GitHub (Oct 16, 2025): @dkmnx what kind of project is it? Perhaps lsp servers are eating up the memory
Author
Owner

@dkmnx commented on GitHub (Oct 16, 2025):

@rekram1-node, its a rust project.

@dkmnx commented on GitHub (Oct 16, 2025): @rekram1-node, its a rust project.
Author
Owner

@rekram1-node commented on GitHub (Oct 16, 2025):

@dkmnx is it fixed if you do:
opencode.json

{
"lsp": {
    "rust": {
      "disabled": true
    }
  },
}
@rekram1-node commented on GitHub (Oct 16, 2025): @dkmnx is it fixed if you do: opencode.json ``` { "lsp": { "rust": { "disabled": true } }, } ```
Author
Owner

@GitMurf commented on GitHub (Oct 28, 2025):

Any updates here or suggestions from anyone? In my tiny neovim config directory I am getting large spikes in memory and cpu while streaming in chat responses. I am using WSL.

@GitMurf commented on GitHub (Oct 28, 2025): Any updates here or suggestions from anyone? In my tiny neovim config directory I am getting large spikes in memory and cpu while streaming in chat responses. I am using WSL.
Author
Owner

@rekram1-node commented on GitHub (Oct 28, 2025):

rewrite ships soon, hard to say what is causing your issue, maybe dry disabling the lua lsp?

{
"lsp": {
    "lua-ls": {
      "disabled": true
    }
  },
}
@rekram1-node commented on GitHub (Oct 28, 2025): rewrite ships soon, hard to say what is causing your issue, maybe dry disabling the lua lsp? ``` { "lsp": { "lua-ls": { "disabled": true } }, } ```
Author
Owner

@GitMurf commented on GitHub (Oct 28, 2025):

rewrite ships soon, hard to say what is causing your issue, maybe dry disabling the lua lsp?

Oh is it a full rewrite using opentui?

@GitMurf commented on GitHub (Oct 28, 2025): > rewrite ships soon, hard to say what is causing your issue, maybe dry disabling the lua lsp? Oh is it a full rewrite using opentui?
Author
Owner

@rekram1-node commented on GitHub (Oct 28, 2025):

Yes, all the go code will be gone all the core logic stays.

@rekram1-node commented on GitHub (Oct 28, 2025): Yes, all the go code will be gone all the core logic stays.
Author
Owner

@hmnd commented on GitHub (Nov 12, 2025):

@rekram1-node if I understand correctly, the rewrite is shipped with v1.0? I'm still experiencing debilitating memory usage caused by opencode starting a ton of lsp servers

Image
@hmnd commented on GitHub (Nov 12, 2025): @rekram1-node if I understand correctly, the rewrite is shipped with v1.0? I'm still experiencing debilitating memory usage caused by opencode starting a ton of lsp servers <img width="2234" height="1669" alt="Image" src="https://github.com/user-attachments/assets/1fb9764c-84e7-4599-8743-11502f24260c" />
Author
Owner

@rekram1-node commented on GitHub (Nov 13, 2025):

got it will fix

@rekram1-node commented on GitHub (Nov 13, 2025): got it will fix
Author
Owner

@kanielrkirby commented on GitHub (Nov 24, 2025):

Not sure on the status, and don't have a bunch of time to look through the issues, so forgive me if I'm repeating things.

On the latest version, under Linux, I had a longer running session (maybe 5 /compacts total), and it reached around 25GB RAM usage (which reduced to 1GB when I restarted the process and session).

It certainly could have taken more, but 1. I have doubts it would have helped, and 2. That's a very, very large amount of RAM to be taking for what I understand it's doing.

@kanielrkirby commented on GitHub (Nov 24, 2025): Not sure on the status, and don't have a bunch of time to look through the issues, so forgive me if I'm repeating things. On the latest version, under Linux, I had a longer running session (maybe 5 `/compact`s total), and it reached around 25GB RAM usage (which reduced to 1GB when I restarted the process and session). It certainly could have taken more, but 1. I have doubts it would have helped, and 2. That's a very, _very_ large amount of RAM to be taking for what I understand it's doing.
Author
Owner

@rekram1-node commented on GitHub (Nov 24, 2025):

Yeah we have been trying to patch these things as we spot them. I guess something is still slipping through. I wonder could it be the LSP server? What language are you normally interacting w/?

I mostly write TS these days but never run into this issue ever

@rekram1-node commented on GitHub (Nov 24, 2025): Yeah we have been trying to patch these things as we spot them. I guess something is still slipping through. I wonder could it be the LSP server? What language are you normally interacting w/? I mostly write TS these days but never run into this issue ever
Author
Owner

@kanielrkirby commented on GitHub (Nov 25, 2025):

Mostly Python and XML recently. The interesting thing is the Python LSP is off (I found it annoying personally with the type errors and whatnot).

I have 64GB RAM, and an entirely new session usually starts at 1GB and starts approaching 12GB or so.

/new also does not restore any RAM.

@kanielrkirby commented on GitHub (Nov 25, 2025): Mostly Python and XML recently. The interesting thing is the Python LSP is off (I found it annoying personally with the type errors and whatnot). I have 64GB RAM, and an entirely new session usually starts at 1GB and starts approaching 12GB or so. `/new` also does not restore any RAM.
Author
Owner

@rekram1-node commented on GitHub (Nov 25, 2025):

hmm okay we will look into it...

@rekram1-node commented on GitHub (Nov 25, 2025): hmm okay we will look into it...
Author
Owner

@waynehearn commented on GitHub (Nov 26, 2025):

I am using .net and have similar issue. Bun grows to 18G, I have 32G then it crashes and the terminal stops working. Happens after I have been working for a while. If I resume a session that was a long session it happens sooner.

@waynehearn commented on GitHub (Nov 26, 2025): I am using .net and have similar issue. Bun grows to 18G, I have 32G then it crashes and the terminal stops working. Happens after I have been working for a while. If I resume a session that was a long session it happens sooner.
Author
Owner

@kanielrkirby commented on GitHub (Nov 28, 2025):

hmm okay we will look into it...

Happy to test some things if you need in my free time. Otherwise, wish you luck.

@kanielrkirby commented on GitHub (Nov 28, 2025): > hmm okay we will look into it... Happy to test some things if you need in my free time. Otherwise, wish you luck.
Author
Owner

@LautaroGScholtus commented on GitHub (Jan 12, 2026):

limit the resources for opencode process
systemd-run --user --pty -p MemoryMax=8G -p CPUQuota=400% opencode
until they resolve the memory leak

@LautaroGScholtus commented on GitHub (Jan 12, 2026): limit the resources for opencode process `systemd-run --user --pty -p MemoryMax=8G -p CPUQuota=400% opencode` until they resolve the memory leak
Author
Owner

@apekros commented on GitHub (Jan 14, 2026):

@dkmnx is it fixed if you do: opencode.json

{
"lsp": {
    "rust": {
      "disabled": true
    }
  },
}

For me yes this resolves it. Otherwise it becomes an unmanageable amount of memory usage.

@apekros commented on GitHub (Jan 14, 2026): > [@dkmnx](https://github.com/dkmnx) is it fixed if you do: opencode.json > > ``` > { > "lsp": { > "rust": { > "disabled": true > } > }, > } > ``` For me yes this resolves it. Otherwise it becomes an unmanageable amount of memory usage.
Author
Owner

@rekram1-node commented on GitHub (Jan 15, 2026):

interesting...

@rekram1-node commented on GitHub (Jan 15, 2026): interesting...
Author
Owner

@apekros commented on GitHub (Jan 15, 2026):

interesting...

Claude Code with rust-analyser LSP enabled does not have the same issue, ghostty/nixos if that helps at all either.

@apekros commented on GitHub (Jan 15, 2026): > interesting... Claude Code with rust-analyser LSP enabled does not have the same issue, ghostty/nixos if that helps at all either.
Author
Owner

@rekram1-node commented on GitHub (Jan 15, 2026):

their lsp serves different purposes and is only agent invoked afaik so im not surprised, but rust lsp is extremely memory hungry anytime I open rust projects in my ide it swallows a lot.

We should figure out how to mitigate this tho..

@rekram1-node commented on GitHub (Jan 15, 2026): their lsp serves different purposes and is only agent invoked afaik so im not surprised, but rust lsp is extremely memory hungry anytime I open rust projects in my ide it swallows a lot. We should figure out how to mitigate this tho..
Author
Owner

@apekros commented on GitHub (Jan 15, 2026):

their lsp serves different purposes and is only agent invoked afaik so im not surprised, but rust lsp is extremely memory hungry anytime I open rust projects in my ide it swallows a lot.

We should figure out how to mitigate this tho..

ah okay understood. would be great to mitigate it, it's only an issue for me on RAM limited VMs as it quickly grows to eat up >16gb

@apekros commented on GitHub (Jan 15, 2026): > their lsp serves different purposes and is only agent invoked afaik so im not surprised, but rust lsp is extremely memory hungry anytime I open rust projects in my ide it swallows a lot. > > We should figure out how to mitigate this tho.. ah okay understood. would be great to mitigate it, it's only an issue for me on RAM limited VMs as it quickly grows to eat up >16gb
Author
Owner

@KaranjotVendal commented on GitHub (Feb 4, 2026):

Just here to mention I think I am having the same issue with my opencode version (1.1.51). I tried building with the following Fixes PR https://github.com/anomalyco/opencode/pull/11717 and PR https://github.com/anomalyco/opencode/pull/10914 still doesn't help. I am using an omarchy machine.

Image

@KaranjotVendal commented on GitHub (Feb 4, 2026): Just here to mention I think I am having the same issue with my opencode version (1.1.51). I tried building with the following Fixes PR https://github.com/anomalyco/opencode/pull/11717 and PR https://github.com/anomalyco/opencode/pull/10914 still doesn't help. I am using an omarchy machine. ![Image](https://github.com/user-attachments/assets/2be64a1e-9baf-43ac-8bdb-968267e463c7)
Author
Owner

@broskees commented on GitHub (Feb 7, 2026):

running into this too ):

@broskees commented on GitHub (Feb 7, 2026): running into this too ):
Author
Owner

@AhmedBenyahia commented on GitHub (Feb 15, 2026):

I've noticed this too from the first time I tried it. I thought it's just my PC having issues. Now it's been two weeks and i am sure it's opencaude. I am running it in wsl. Honestly, it's very annoying as I have to kill my IDE and restart everything, It will also stop in the middle of the task

@AhmedBenyahia commented on GitHub (Feb 15, 2026): I've noticed this too from the first time I tried it. I thought it's just my PC having issues. Now it's been two weeks and i am sure it's opencaude. I am running it in wsl. Honestly, it's very annoying as I have to kill my IDE and restart everything, It will also stop in the middle of the task
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1988