Skip to content

[BUG/PERF] Severe Memory Leak and Disk Swell leading to System Kernel Panic (macOS) #12687

@dzianisv

Description

@dzianisv

Description

I am encountering a critical performance issue when using OpenCode at scale. While the TypeScript implementation is impressive, the current resource management leads to total system instability on macOS. After a few hours of intensive use, the system undergoes a forced restart due to memory exhaustion.

Observed Behavior
RAM/Swap Exhaustion: OpenCode consumes all available physical RAM and then expands into Swap until macOS triggers a kernel panic or forced restart.

Disk Swell: Approximately 50GB of disk space is consumed within a few hours. This space is reclaimed immediately after a restart, suggesting it is either a ballooning swapfile or unmanaged session storage.

System Impact: Daily mandatory restarts of the host machine (MacBook).

Investigation Plan
I am treating this as a research-based issue rather than a standard bug report. My next steps include:

Process Monitoring: Identifying if the leak is in the main process, a specific worker, or the underlying TUI/Language Server.

Storage Audit: Locating the specific directory where the 50GB swell occurs (e.g., ~/Library/Application Support/OpenCode or /private/var/vm).

Heap Snapshots: Attempting to capture V8 heap snapshots before the system freezes.

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingperfIndicates 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