Excessive memory usage. #2330

Closed
opened 2026-02-16 17:35:09 -05:00 by yindo · 20 comments
Owner

Originally created by @Iweisc on GitHub (Oct 29, 2025).

Description

I suddenly noticed that my mac was lagging, so i opened activity monitor and saw this.

Image

OpenCode version

v0.15.23

Steps to reproduce

  1. Open opencode
  2. Keep using it for a long time

Screenshot and/or share link

Image

Operating System

MacOS 26.1

Terminal

Ghostty

Originally created by @Iweisc on GitHub (Oct 29, 2025). ### Description I suddenly noticed that my mac was lagging, so i opened activity monitor and saw this. <img width="1233" height="30" alt="Image" src="https://github.com/user-attachments/assets/3b7adbd9-f1d4-4d7f-a434-95e2610f5b42" /> ### OpenCode version v0.15.23 ### Steps to reproduce 1. Open opencode 2. Keep using it for a long time ### Screenshot and/or share link <img width="1233" height="30" alt="Image" src="https://github.com/user-attachments/assets/1da4cebe-5c1f-489a-b822-fc6086b7ef52" /> ### Operating System MacOS 26.1 ### Terminal Ghostty
yindo added the bug label 2026-02-16 17:35:09 -05:00
yindo closed this issue 2026-02-16 17:35:09 -05:00
Author
Owner

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

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

  • #3013: Uses a huge amount of memory - reports increasing memory usage during AI sessions until the app gets stuck
  • #2805: High RAM usage in latest release - related to Bun runtime memory consumption on Windows
  • #3094: Performance noticeably drops with very long history - reports over 6GB memory consumption with performance issues
  • #2585: Massive memory use on opening opencode when there is a very large file - reports 29GB RAM usage causing system slowdown

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

@github-actions[bot] commented on GitHub (Oct 29, 2025): This issue might be a duplicate of existing issues. Please check: - #3013: Uses a huge amount of memory - reports increasing memory usage during AI sessions until the app gets stuck - #2805: High RAM usage in latest release - related to Bun runtime memory consumption on Windows - #3094: Performance noticeably drops with very long history - reports over 6GB memory consumption with performance issues - #2585: Massive memory use on opening opencode when there is a very large file - reports 29GB RAM usage causing system slowdown Feel free to ignore if none of these address your specific case.
Author
Owner

@istarkov commented on GitHub (Oct 29, 2025):

Seems like in my case clearing all sessions (mac)

# !!! THIS WILL DELETE ALL SESSIONS HISTORY
rm -rf ~/.local/share/opencode/storage/*

helps with freezes and memory. Otherwise switching to the subagent session (shift - right) feels like disaster.

@istarkov commented on GitHub (Oct 29, 2025): Seems like in my case clearing all sessions (mac) ```shell # !!! THIS WILL DELETE ALL SESSIONS HISTORY rm -rf ~/.local/share/opencode/storage/* ``` helps with freezes and memory. Otherwise switching to the subagent session (shift - right) feels like disaster.
Author
Owner

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

We are about to ship some performance improvements, I think the child session one actually hasn't been addressed quite yet but I will check it out thanks.

@rekram1-node commented on GitHub (Oct 29, 2025): We are about to ship some performance improvements, I think the child session one actually hasn't been addressed quite yet but I will check it out thanks.
Author
Owner

@awkay commented on GitHub (Dec 30, 2025):

I'm getting system crashes from excessive memory use with latest version

@awkay commented on GitHub (Dec 30, 2025): I'm getting system crashes from excessive memory use with latest version
Author
Owner

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

I'm getting system crashes from excessive memory use with latest version

get more ram.

@Iweisc commented on GitHub (Dec 31, 2025): > I'm getting system crashes from excessive memory use with latest version get more ram.
Author
Owner

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

I'm getting system crashes from excessive memory use with latest version

get more ram.

I have plenty of RAM. Learn how to write software that doesn't try to consume literally 178GB of VM.

@awkay commented on GitHub (Dec 31, 2025): > > I'm getting system crashes from excessive memory use with latest version > > get more ram. I have plenty of RAM. Learn how to write software that doesn't try to consume literally 178GB of VM.
Author
Owner

@Iweisc commented on GitHub (Jan 3, 2026):

I'm getting system crashes from excessive memory use with latest version

get more ram.

I have plenty of RAM. Learn how to write software that doesn't try to consume literally 178GB of VM.

damn.

@Iweisc commented on GitHub (Jan 3, 2026): > > > I'm getting system crashes from excessive memory use with latest version > > > > > > get more ram. > > I have plenty of RAM. Learn how to write software that doesn't try to consume literally 178GB of VM. damn.
Author
Owner

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

my computer literally freezes when I use two agents simultaneously. some new?

@LautaroGScholtus commented on GitHub (Jan 7, 2026): my computer literally freezes when I use two agents simultaneously. some new?
Author
Owner

@omercnet commented on GitHub (Jan 11, 2026):

I should have taken a screenshot but MacOS just asked me to quit OpenCode for taking 50GB(!!!) of RAM

@omercnet commented on GitHub (Jan 11, 2026): I should have taken a screenshot but MacOS just asked me to quit OpenCode for taking 50GB(!!!) of RAM
Author
Owner

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

Hey @omercnet . I'm not sure if there is a similar command on Mac, but on Linux I solved it by limiting the memory available to the opencode process:

systemd-run --user --pty -p MemoryMax=12G -p CPUQuota=400% opencode

I would look for a way to run something similar, or I would be forced to start it with Docker.

@LautaroGScholtus commented on GitHub (Jan 12, 2026): Hey @omercnet . I'm not sure if there is a similar command on Mac, but on Linux I solved it by limiting the memory available to the opencode process: `systemd-run --user --pty -p MemoryMax=12G -p CPUQuota=400% opencode` I would look for a way to run something similar, or I would be forced to start it with Docker.
Author
Owner

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

a proper solution would be to find the memory leaks :)

@omercnet commented on GitHub (Jan 12, 2026): a proper solution would be to find the memory leaks :)
Author
Owner

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

mine is just filling up my hard drive with 100s of GB of TMP files

@comcad commented on GitHub (Jan 14, 2026): mine is just filling up my hard drive with 100s of GB of TMP files
Author
Owner

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

The memory leaks in this are insane. Happening multiple times a day now. Please tell me what infomation you need, where crash logs are etc.

@GukDev commented on GitHub (Jan 19, 2026): The memory leaks in this are insane. Happening multiple times a day now. Please tell me what infomation you need, where crash logs are etc.
Author
Owner

@maxsonderby commented on GitHub (Jan 21, 2026):

happening multiple times a day. have plenty of RAM and opencode is eating up the whole thing and makes it essentially unusable. It's gotten worse the last week or so.

@maxsonderby commented on GitHub (Jan 21, 2026): happening multiple times a day. have plenty of RAM and opencode is eating up the whole thing and makes it essentially unusable. It's gotten worse the last week or so.
Author
Owner

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

same issue here

@aniel300 commented on GitHub (Jan 21, 2026): same issue here
Author
Owner

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

Brand new session in Opencode investigating why my Omarchy laptop froze and had to be powercycled. Within 5 minutes, opencode process reported OOM and process manager should it using 54G of RAM. I quit the Opencode process and RAM usage dropped right back down.

There's some memory leak in Opencode.

@travisaustin commented on GitHub (Jan 22, 2026): Brand new session in Opencode investigating why my Omarchy laptop froze and had to be powercycled. Within 5 minutes, opencode process reported OOM and process manager should it using 54G of RAM. I quit the Opencode process and RAM usage dropped right back down. There's some memory leak in Opencode.
Author
Owner

@itartyom commented on GitHub (Jan 26, 2026):

same issue, opened opencode

Image

this process has children processes named git

Image

and this process keep taking RAM and CPU, even when I do nothing

Image

after 5-10 minutes it grew up from 10G to 19G (I should close opencode where nothing is happening, because my laptop starts freezing)

Image

Laptop: Mac M2 Pro, 16G RAM, opencode 1.1.36

UPD: After I closed opencode RAM is still not freed, I should close processes manually

Image
@itartyom commented on GitHub (Jan 26, 2026): same issue, opened opencode <img width="852" height="496" alt="Image" src="https://github.com/user-attachments/assets/1312772f-d0b5-404a-a442-5bf54c777178" /> this process has children processes named git <img width="852" height="496" alt="Image" src="https://github.com/user-attachments/assets/2f38e04a-e636-4483-84ef-bf2065aec256" /> and this process keep taking RAM and CPU, even when I do nothing <img width="869" height="576" alt="Image" src="https://github.com/user-attachments/assets/7473968e-8282-4985-a187-4e93abb8efe8" /> after 5-10 minutes it grew up from 10G to 19G (I should close opencode where nothing is happening, because my laptop starts freezing) <img width="852" height="496" alt="Image" src="https://github.com/user-attachments/assets/e97cd15f-f52a-4855-91c0-1c33b44e8539" /> Laptop: Mac M2 Pro, 16G RAM, opencode 1.1.36 UPD: After I closed opencode RAM is still not freed, I should close processes manually <img width="758" height="852" alt="Image" src="https://github.com/user-attachments/assets/6172b487-e64d-4943-9f20-3f4b32f21408" />
Author
Owner

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

I think I am having the same issue with my opencode version (1.1.51). I tried building with the following Fixes PR #11717 and PR #10914 still doesn't help. I am using an omarchy machine.

Image

@KaranjotVendal commented on GitHub (Feb 4, 2026): I think I am having the same issue with my opencode version (1.1.51). I tried building with the following Fixes PR #11717 and PR #10914 still doesn't help. I am using an omarchy machine. ![Image](https://github.com/user-attachments/assets/e1445e82-a2eb-4434-8daf-2452fad7fd64)
Author
Owner

@bechampion commented on GitHub (Feb 5, 2026):

We should ask opencode to fix itself , ill try

@bechampion commented on GitHub (Feb 5, 2026): We should ask opencode to fix itself , ill try
Author
Owner

@joneslloyd commented on GitHub (Feb 9, 2026):

Same here. 51GB of RAM being used for long-running and/or multiple sessions.

@joneslloyd commented on GitHub (Feb 9, 2026): Same here. 51GB of RAM being used for long-running and/or multiple sessions.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2330