-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Memory Megathread #20695
Copy link
Copy link
Open
Labels
coreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)perfIndicates a performance issue or need for optimizationIndicates a performance issue or need for optimization
Description
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 exampleOPENCODE_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
.heapsnapshotfiles - 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
coreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)perfIndicates a performance issue or need for optimizationIndicates a performance issue or need for optimization