opencode eating 70gb of memory? #3464

Open
opened 2026-02-16 17:40:12 -05:00 by yindo · 30 comments
Owner

Originally created by @albertilagan on GitHub (Dec 11, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

Left opencode session on background (tmux session) not doing anything but an existing session open.

OpenCode version

1.0.141

Steps to reproduce

No response

Screenshot and/or share link

Image

Operating System

macOS 26.1

Terminal

Ghostty + tmux

Originally created by @albertilagan on GitHub (Dec 11, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description Left opencode session on background (tmux session) not doing anything but an existing session open. ### OpenCode version 1.0.141 ### Steps to reproduce _No response_ ### Screenshot and/or share link <img width="1872" height="182" alt="Image" src="https://github.com/user-attachments/assets/8033c6c0-5a14-4079-aa04-861346387a5d" /> ### Operating System macOS 26.1 ### Terminal Ghostty + tmux
yindo added the bugperf labels 2026-02-16 17:40:12 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Dec 11, 2025):

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

  • #3995: Single opencode session is consuming 23+GB of memory
  • #3013: Uses a huge amount of memory
  • #3798: OpenTUI causes crashes and heavy memory usage
  • #4315: Memory stays unbounded: ACP session map + compacted tool outputs
  • #3530: Excessive memory usage (closed)
  • #2805: High RAM usage in latest release

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

@github-actions[bot] commented on GitHub (Dec 11, 2025): This issue might be a duplicate of existing issues. Please check: - #3995: Single opencode session is consuming 23+GB of memory - #3013: Uses a huge amount of memory - #3798: OpenTUI causes crashes and heavy memory usage - #4315: Memory stays unbounded: ACP session map + compacted tool outputs - #3530: Excessive memory usage (closed) - #2805: High RAM usage in latest release Feel free to ignore if none of these address your specific case.
Author
Owner

@ham-zax commented on GitHub (Dec 11, 2025):

yeah same, it is asking for that much access, i cant use the unlimt command in linux, and i suspect memory leak too. i have to close the opencode completely after some hour and restart it otherwise it would get hang

@ham-zax commented on GitHub (Dec 11, 2025): yeah same, it is asking for that much access, i cant use the unlimt command in linux, and i suspect memory leak too. i have to close the opencode completely after some hour and restart it otherwise it would get hang
Author
Owner

@supersongssr commented on GitHub (Dec 11, 2025):

yeah same , Macbook M1 , macos 26.1 (25B78) . eating 7GB of memory .

@supersongssr commented on GitHub (Dec 11, 2025): yeah same , Macbook M1 , macos 26.1 (25B78) . eating 7GB of memory .
Author
Owner

@rekram1-node commented on GitHub (Dec 11, 2025):

Can anyone share a session causing this?

opencode export > session.json

You can dm privately too

I can't replicate this

@rekram1-node commented on GitHub (Dec 11, 2025): Can anyone share a session causing this? `opencode export > session.json` You can dm privately too I can't replicate this
Author
Owner

@albertilagan commented on GitHub (Dec 11, 2025):

Can anyone share a session causing this?

opencode export > session.json

You can dm privately too

I can't replicate this

how/where do I dm you sir?

@albertilagan commented on GitHub (Dec 11, 2025): > Can anyone share a session causing this? > > `opencode export > session.json` > > You can dm privately too > > I can't replicate this how/where do I dm you sir?
Author
Owner

@rekram1-node commented on GitHub (Dec 11, 2025):

x or discord? click my gh profile for details

@rekram1-node commented on GitHub (Dec 11, 2025): x or discord? click my gh profile for details
Author
Owner

@albertilagan commented on GitHub (Dec 11, 2025):

x or discord? click my gh profile for details

don't have x, I do have discord but link on profile says invalid.

@albertilagan commented on GitHub (Dec 11, 2025): > x or discord? click my gh profile for details don't have x, I do have discord but link on profile says invalid.
Author
Owner

@rekram1-node commented on GitHub (Dec 11, 2025):

dm:

aidenc9727 on discord

@rekram1-node commented on GitHub (Dec 11, 2025): dm: aidenc9727 on discord
Author
Owner

@PSU3D0 commented on GitHub (Dec 12, 2025):

Same issue. Opencode consumed 15Gb Memory in one instance. With multiple parallel instances, ended up crashing my Xserver (Ubuntu 24.04) with 128Gb memory

Common pattern across all sessions:

2-3 opencode instances per git repo
Average 2-3 compactions per session
All running parallel

@PSU3D0 commented on GitHub (Dec 12, 2025): Same issue. Opencode consumed 15Gb Memory in one instance. With multiple parallel instances, ended up crashing my Xserver (Ubuntu 24.04) with 128Gb memory Common pattern across all sessions: 2-3 opencode instances per git repo Average 2-3 compactions per session All running parallel
Author
Owner

@noneatarrival commented on GitHub (Dec 18, 2025):

Same issue. Mac using Sequoia 15.7.2. node balloons to >70GB within 30 seconds... suspect it is b/c one of the sub-folders w/in the folder I start in has many large files, so my bad 😓

@noneatarrival commented on GitHub (Dec 18, 2025): Same issue. Mac using Sequoia 15.7.2. node balloons to >70GB within 30 seconds... suspect it is b/c one of the sub-folders w/in the folder I start in has many large files, so my bad 😓
Author
Owner

@JayBusch commented on GitHub (Dec 21, 2025):

Same here.... grows until I nearly OOM then I have to restart.

@JayBusch commented on GitHub (Dec 21, 2025): Same here.... grows until I nearly OOM then I have to restart.
Author
Owner

@dhruvkej9 commented on GitHub (Dec 31, 2025):

@rekram1-node @thdxr When this issue is gonna fix? My opencode nearly crashes 30 times a day, I will share the session if you want. (it runs OOM)

I also have the logs how it crashed (kernel logs)

This is the issue I am talking about: https://github.com/code-yeongyu/oh-my-opencode/issues/361#issuecomment-3701213867

@dhruvkej9 commented on GitHub (Dec 31, 2025): @rekram1-node @thdxr When this issue is gonna fix? My opencode nearly crashes 30 times a day, I will share the session if you want. (it runs OOM) I also have the logs how it crashed (kernel logs) This is the issue I am talking about: https://github.com/code-yeongyu/oh-my-opencode/issues/361#issuecomment-3701213867
Author
Owner

@Sharktheone commented on GitHub (Jan 9, 2026):

Same issue on Linux with 50GB+ of memory

Image

At least for me the memory usage was quite inconsistent at some point it was ~30GB and a few seconds later at ~50GB. After the agent finished memory usage went down to ~14GB and after some time to ~5.5GB which suggests that it is not a "full" memory leak

Not sure how useful the two files are as I captured them when the memory usage recovered.

proc-status.txt

opencode-pmap.txt

Environment:
Kernel: 6.16.3-zen1-1-zen
Terminal: Ghostty
OpenCode Version: Custom built from 685f3ea324 (Yes, I know not that recent, I'll try to reproduce with the latest version)

Note that the opencode UI even corrupted itself at some point, but the agent continued building.

@Sharktheone commented on GitHub (Jan 9, 2026): Same issue on Linux with 50GB+ of memory <img width="353" height="88" alt="Image" src="https://github.com/user-attachments/assets/83b8e8cd-14c0-4f31-809e-516073ea28c6" /> At least for me the memory usage was quite inconsistent at some point it was ~30GB and a few seconds later at ~50GB. After the agent finished memory usage went down to ~14GB and after some time to ~5.5GB which suggests that it is not a "full" memory leak Not sure how useful the two files are as I captured them when the memory usage recovered. [proc-status.txt](https://github.com/user-attachments/files/24537670/proc-status.txt) [opencode-pmap.txt](https://github.com/user-attachments/files/24537675/opencode-pmap.txt) Environment: Kernel: 6.16.3-zen1-1-zen Terminal: Ghostty OpenCode Version: Custom built from 685f3ea324cf5d0401f7b0895a78560149bf8a4b (Yes, I know not that recent, I'll try to reproduce with the latest version) Note that the opencode UI even corrupted itself at some point, but the agent continued building.
Author
Owner

@dhruvkej9 commented on GitHub (Jan 9, 2026):

Same issue on Linux with 50GB+ of memory

Image

At least for me the memory usage was quite inconsistent at some point it was ~30GB and a few seconds later at ~50GB. After the agent finished memory usage went down to ~14GB and after some time to ~5.5GB which suggests that it is not a "full" memory leak

Not sure how useful the two files are as I captured them when the memory usage recovered.

proc-status.txt

opencode-pmap.txt

Environment:
Kernel: 6.16.3-zen1-1-zen
Terminal: Ghostty
OpenCode Version: Custom built from 685f3ea324 (Yes, I know not that recent, I'll try to reproduce with the latest version)

Note that the opencode UI even corrupted itself at some point, but the agent continued building.

Latest version has major memory fixes

@dhruvkej9 commented on GitHub (Jan 9, 2026): > Same issue on Linux with 50GB+ of memory > > <img width="353" height="88" alt="Image" src="https://github.com/user-attachments/assets/83b8e8cd-14c0-4f31-809e-516073ea28c6" /> > > At least for me the memory usage was quite inconsistent at some point it was ~30GB and a few seconds later at ~50GB. After the agent finished memory usage went down to ~14GB and after some time to ~5.5GB which suggests that it is not a "full" memory leak > > Not sure how useful the two files are as I captured them when the memory usage recovered. > > [proc-status.txt](https://github.com/user-attachments/files/24537670/proc-status.txt) > > [opencode-pmap.txt](https://github.com/user-attachments/files/24537675/opencode-pmap.txt) > > Environment: > Kernel: 6.16.3-zen1-1-zen > Terminal: Ghostty > OpenCode Version: Custom built from 685f3ea324cf5d0401f7b0895a78560149bf8a4b (Yes, I know not that recent, I'll try to reproduce with the latest version) > > Note that the opencode UI even corrupted itself at some point, but the agent continued building. > Latest version has major memory fixes
Author
Owner

@Sharktheone commented on GitHub (Jan 17, 2026):

Latest version has major memory fixes

Don't seem to see that here. It got up to 60GB only this time it doesn't recover after the agent finished working.

Image

After quitting, it seemed to also hit the Swap quite hard:

Image
@Sharktheone commented on GitHub (Jan 17, 2026): > Latest version has major memory fixes Don't seem to see that here. It got up to 60GB only this time it doesn't recover after the agent finished working. <img width="413" height="100" alt="Image" src="https://github.com/user-attachments/assets/2963d0d5-570b-4790-96c1-30631f8288c0" /> After quitting, it seemed to also hit the Swap quite hard: <img width="774" height="365" alt="Image" src="https://github.com/user-attachments/assets/277b57c5-f092-46a4-b326-70ae6ef7b602" />
Author
Owner

@dhruvkej9 commented on GitHub (Jan 18, 2026):

Latest version has major memory fixes

Don't seem to see that here. It got up to 60GB only this time it doesn't recover after the agent finished working.

Image

After quitting, it seemed to also hit the Swap quite hard:

Image

Same here, don't know why when we continue using the session why the memory keeps on increasing and we restart it then the RAM becomes normal like it is the same session everything got loaded again same, why then lesser RAM?

@dhruvkej9 commented on GitHub (Jan 18, 2026): > > Latest version has major memory fixes > > Don't seem to see that here. It got up to 60GB only this time it doesn't recover after the agent finished working. > > <img width="413" height="100" alt="Image" src="https://github.com/user-attachments/assets/2963d0d5-570b-4790-96c1-30631f8288c0" /> > > After quitting, it seemed to also hit the Swap quite hard: > > <img width="774" height="365" alt="Image" src="https://github.com/user-attachments/assets/277b57c5-f092-46a4-b326-70ae6ef7b602" /> > > Same here, don't know why when we continue using the session why the memory keeps on increasing and we restart it then the RAM becomes normal like it is the same session everything got loaded again same, why then lesser RAM?
Author
Owner

@DerekCorniello commented on GitHub (Jan 19, 2026):

having the same issue right now on arch + hyprland

@DerekCorniello commented on GitHub (Jan 19, 2026): having the same issue right now on arch + hyprland
Author
Owner

@GukDev commented on GitHub (Jan 19, 2026):

Same issue

@GukDev commented on GitHub (Jan 19, 2026): Same issue
Author
Owner

@censey commented on GitHub (Jan 20, 2026):

Same here - takes all memory available until a restart

@censey commented on GitHub (Jan 20, 2026): Same here - takes all memory available until a restart
Author
Owner

@Luis-Munu commented on GitHub (Jan 21, 2026):

Having the same issue here repeteadly, Bum usage slowly increases over time until it fills the entire available RAM (32GB in this case) of the machine. Single opencode instance. Windows 11.

@Luis-Munu commented on GitHub (Jan 21, 2026): Having the same issue here repeteadly, Bum usage slowly increases over time until it fills the entire available RAM (32GB in this case) of the machine. Single opencode instance. Windows 11.
Author
Owner

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

Does anyone have this issue specifically in:

  • rust projects
  • projects with git submodules in them << today I had 4 reports all specifically w/ this setup so we are thinking something related to that is causing issues

If neither apply to you just thumbs down or ignore :)

@rekram1-node commented on GitHub (Jan 21, 2026): Does anyone have this issue specifically in: - rust projects - projects with git submodules in them << today I had 4 reports all specifically w/ this setup so we are thinking something related to that is causing issues If neither apply to you just thumbs down or ignore :)
Author
Owner

@NobbZ commented on GitHub (Jan 22, 2026):

When I observed it the last time, it was in a rust project with collocated jujutsu version control, but no submodules.

On the elixir, astro and lua projects I have, there have been no issues observed.

At the same time, the rust project that was affected last time, has an opencode instance running without doing anything for ~4 hours now and the RAM usage of that process remained stable…

@NobbZ commented on GitHub (Jan 22, 2026): When I observed it the last time, it was in a rust project with collocated jujutsu version control, but no submodules. On the elixir, astro and lua projects I have, there have been no issues observed. At the same time, the rust project that was affected last time, has an opencode instance running without doing anything for ~4 hours now and the RAM usage of that process remained stable…
Author
Owner

@aniel300 commented on GitHub (Jan 22, 2026):

@rekram1-node am using git

@aniel300 commented on GitHub (Jan 22, 2026): @rekram1-node am using git
Author
Owner

@Sharktheone commented on GitHub (Jan 22, 2026):

For me it also was rust. I mean rust_analyzer can take up it's ram. And I've seen opencode spawning multiple LSP instances at the same time. It would make sense that the ram is stacking up, allthough that would probably be another process (unless they are using a WASM / embedded build of rust_analyzer, I doubt).

So maybe it is rust_analyzer spamming opencode with LSP things which opencode just keeps around for no real reason?

@Sharktheone commented on GitHub (Jan 22, 2026): For me it also was rust. I mean rust_analyzer can take up it's ram. And I've seen opencode spawning multiple LSP instances at the same time. It would make sense that the ram is stacking up, allthough that would probably be another process (unless they are using a WASM / embedded build of rust_analyzer, I doubt). So maybe it is rust_analyzer spamming opencode with LSP things which opencode just keeps around for no real reason?
Author
Owner

@beingsuz commented on GitHub (Jan 22, 2026):

Image

same using the bun install command

@beingsuz commented on GitHub (Jan 22, 2026): <img width="728" height="136" alt="Image" src="https://github.com/user-attachments/assets/989b3796-6e65-4907-ae50-eb2c671ccca4" /> same using the bun install command
Author
Owner

@jfkr commented on GitHub (Jan 23, 2026):

Same issue with RAM usage here on a daily basis now. I have opencode working on PHP projects, no rust involved. Unfortunately not really useable right now.

@jfkr commented on GitHub (Jan 23, 2026): Same issue with RAM usage here on a daily basis now. I have opencode working on PHP projects, no rust involved. Unfortunately not really useable right now.
Author
Owner

@Sharktheone commented on GitHub (Jan 23, 2026):

Image

same using the bun install command

Is that just bun install hanging? I had the same at some point but didn't check the ram usage.

I'm also getting it on macos (as the initial issue also was)

Image
@Sharktheone commented on GitHub (Jan 23, 2026): > <img alt="Image" width="728" height="136" src="https://private-user-images.githubusercontent.com/42787030/539553981-989b3796-6e65-4907-ae50-eb2c671ccca4.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NjkxNjcxOTYsIm5iZiI6MTc2OTE2Njg5NiwicGF0aCI6Ii80Mjc4NzAzMC81Mzk1NTM5ODEtOTg5YjM3OTYtNmU2NS00OTA3LWFlNTAtZWIyYzY3MWNjY2E0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAxMjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMTIzVDExMTQ1NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE2YmRiMmQ4YjZjZTFhMzU0OGMyNGM4NzE5ZjVlNjZkOWJkODM0ZjQwMGY2YTNiMjI2ODUyMzQzZjY5NWYwZGUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.DDfBfoxOqGHwhzKxSvo2aU4mA0s5F8iR3XVFwIcWgtA"> > > same using the bun install command Is that just `bun install` hanging? I had the same at some point but didn't check the ram usage. I'm also getting it on macos (as the initial issue also was) <img width="1586" height="202" alt="Image" src="https://github.com/user-attachments/assets/39522356-6882-412b-9f34-be147483bd73" />
Author
Owner

@beingsuz commented on GitHub (Jan 23, 2026):

Image same using the bun install command

Is that just bun install hanging? I had the same at some point but didn't check the ram usage.

I'm also getting it on macos (as the initial issue also was)

Image

Not at all when installing using Bun after running it runs under Bun process for some reason.

@beingsuz commented on GitHub (Jan 23, 2026): > > <img alt="Image" width="728" height="136" src="https://private-user-images.githubusercontent.com/42787030/539553981-989b3796-6e65-4907-ae50-eb2c671ccca4.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NjkxNjcxOTYsIm5iZiI6MTc2OTE2Njg5NiwicGF0aCI6Ii80Mjc4NzAzMC81Mzk1NTM5ODEtOTg5YjM3OTYtNmU2NS00OTA3LWFlNTAtZWIyYzY3MWNjY2E0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAxMjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMTIzVDExMTQ1NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE2YmRiMmQ4YjZjZTFhMzU0OGMyNGM4NzE5ZjVlNjZkOWJkODM0ZjQwMGY2YTNiMjI2ODUyMzQzZjY5NWYwZGUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.DDfBfoxOqGHwhzKxSvo2aU4mA0s5F8iR3XVFwIcWgtA"> > > same using the bun install command > > Is that just `bun install` hanging? I had the same at some point but didn't check the ram usage. > > I'm also getting it on macos (as the initial issue also was) > > <img alt="Image" width="1586" height="202" src="https://private-user-images.githubusercontent.com/105171995/539721347-39522356-6882-412b-9f34-be147483bd73.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NjkyMjIzMjUsIm5iZiI6MTc2OTIyMjAyNSwicGF0aCI6Ii8xMDUxNzE5OTUvNTM5NzIxMzQ3LTM5NTIyMzU2LTY4ODItNDEyYi05ZjM0LWJlMTQ3NDgzYmQ3My5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwMTI0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDEyNFQwMjMzNDVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1hNGRjN2I4N2NiMzcwODAxNTMzMjVmY2Y2YTgxMzkwNDhhZTYwZTk5YjlkNjNkMjczMjA1ZGFlOTlkNjQ5NjhkJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.lf77MOUWdP0uq0hzhuRMbkF62IsTKh3Ar-OKv0bEbcQ"> Not at all when installing using Bun after running it runs under Bun process for some reason.
Author
Owner

@mohamedbouddi7777-dev commented on GitHub (Feb 1, 2026):

Free the world

@mohamedbouddi7777-dev commented on GitHub (Feb 1, 2026): Free the world
Author
Owner

@d4rky-pl commented on GitHub (Feb 11, 2026):

I just experienced the memory spike issue, opencode inside Docker container. The CPU went 100%, the MacBook fans started spinning like crazy and the memory use kept climbing up to 5 GB. I switched to new session and it was still going.

Image

In my case the issue was with LSP server, specifically pyright-langserver. I've managed to capture htop output:

Image

Once the CPU burn calmed down it's still using tons of RAM:

Image

This RAM usage displayed in the opencode debug apparently does not take LSP servers into account:

Image

Opencode 1.1.53, I forgot to update this morning, so if this is known issue / no longer helpful then apologies for the noise.

@d4rky-pl commented on GitHub (Feb 11, 2026): I just experienced the memory spike issue, opencode inside Docker container. The CPU went 100%, the MacBook fans started spinning like crazy and the memory use kept climbing up to 5 GB. I switched to new session and it was still going. <img width="226" height="40" alt="Image" src="https://github.com/user-attachments/assets/c935ec9a-4da6-4231-a4a6-640fab597b72" /> In my case the issue was with LSP server, specifically pyright-langserver. I've managed to capture `htop` output: <img width="1799" height="472" alt="Image" src="https://github.com/user-attachments/assets/056cdbce-caf7-498d-9967-d72e15cac38e" /> Once the CPU burn calmed down it's still using tons of RAM: <img width="1800" height="251" alt="Image" src="https://github.com/user-attachments/assets/50d1336b-00aa-48a8-92d0-041d5000af69" /> This RAM usage displayed in the opencode debug apparently does not take LSP servers into account: <img width="295" height="197" alt="Image" src="https://github.com/user-attachments/assets/8bfdd2a8-53a8-4fa7-8b88-851bdd51fd2b" /> Opencode 1.1.53, I forgot to update this morning, so if this is known issue / no longer helpful then apologies for the noise.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3464