Skip to content

Large file tracked by opencode git tool causes OOM #17252

@elijahmorg

Description

@elijahmorg

Description

I had a very large file (+200MB) sucked into my opencode session.

Then I ran multiple sub agents that somehow also pulled it into their sessions causing a ballooning memory issue.

The file was technically json, but wasn't something that opencode touched or modified. It was generated by a tool and I was deleting it.

Doing some digging and it appears that the file was sucked in by Snapshot.diffFull

Tangentially related to this is that all sub-agent sessions are fully loaded into a main session when you reload. So when I close and reload my session it immediately balloons back up even tho most of the large diff elements are residing in the sub-agent sessions.

Plugins

None

OpenCode version

issue exists on dev branch

Steps to reproduce

  1. have a large text blob (you can generate one by doing export heap snapshot in opencode)
  2. send one message
  3. delete large text blob
  4. see memory footprint increase
  5. can also do the same thing with sub agents too multiply the issue

Screenshot and/or share link

No response

Operating System

macOS

Terminal

iterm2

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)perfIndicates a performance issue or need for optimization

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions