Skip to content

Memory Megathread #20695

@thdxr

Description

@thdxr

We have scattered reports of memory issues so we are going to tackle them all in a central place.

PLEASE DO NOT RUN YOUR LLM AND SUGGEST SOLUTIONS IT IS ALWAYS WRONG

What we need help with is collecting heap snapshots. There are two ways to do that.

Manual snapshot flow

  • run opencode (terminal not desktop)
  • use it until memory has grown (we don't need crazy numbers, once it hits 1-2gb it should help)
  • press ctrl+p and select heap snapshot
  • ui will freeze while it is generated
  • upload generated files here
  • leave a comment describing your issue a bit

Automatic snapshot flow

  • run opencode with OPENCODE_AUTO_HEAP_SNAPSHOT=1, for example OPENCODE_AUTO_HEAP_SNAPSHOT=1 opencode
  • use it until memory grows past around 2gb
  • opencode checks memory once a minute and automatically writes a heap snapshot when rss is above 2gb
  • snapshots are written to the log directory as .heapsnapshot files
  • upload generated files here
  • leave a comment describing your issue a bit and mention that you used the automatic flow

If you follow this we can almost always trace the issue and fix it

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)perfIndicates a performance issue or need for optimization

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions