GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Memory leak: SDK event listeners never unsubscribed in App component · Issue #8258 · anomalyco/opencode

Memory leak: SDK event listeners never unsubscribed in App component #8258

New issue
Copy link
New issue
Copy link
Closed
Closed
Memory leak: SDK event listeners never unsubscribed in App component#8258
Copy link
Assignees
rekram1-node
Labels
perfIndicates a performance issue or need for optimization

Description

@sauerdaniel
sauerdaniel
opened on Jan 13, 2026
Issue body actions

Problem

The TUI App component subscribes to 6 SDK events but never unsubscribes from them:

  • TuiEvent.CommandExecute
  • TuiEvent.ToastShow
  • TuiEvent.SessionSelect
  • SessionApi.Event.Deleted
  • SessionApi.Event.Error
  • Installation.Event.UpdateAvailable

The sdk.event.on() method returns an unsubscribe function that is being ignored.

Code Location

packages/opencode/src/cli/cmd/tui/app.tsx - lines 557-616

Impact

  • Event listeners accumulate over component lifecycle
  • Closures retain references preventing garbage collection
  • Memory growth in long-running sessions
  • Potential duplicate event handling

Relates to #5363

Expected Behavior

Event listeners should be stored and unsubscribed in onCleanup:

const unsubs: (() => void)[] = []

unsubs.push(sdk.event.on(TuiEvent.CommandExecute.type, (evt) => {
  command.trigger(evt.properties.command)
}))

// ... other listeners

onCleanup(() => {
  unsubs.forEach((unsub) => unsub())
})

Activity

  1. github-actions commented on Jan 13, 2026

    @github-actions
    github-actionsBot
    on Jan 13, 2026 – with GitHub Actions
    Contributor
    More actions

    This issue might be part of a series of related memory leaks in the TUI. Please check:

    • Memory leak: MCP clients not closed before reassignment #8257: Memory leak from MCP clients not being closed before reassignment
    • Memory leak: Footer component only clears last timeout in recursive chain #8259: Memory leak from Footer component only clearing last timeout in recursive chain

    All three are part of #3013 (general memory issues). You may want to coordinate fixes across these related issues to address the broader memory leak problem systematically.

  2. github-actions
    assigned
    rekram1-node
    on Jan 13, 2026
  3. github-actions
    added
    perfIndicates a performance issue or need for optimization
    on Jan 13, 2026
  4. github-actions commented on Mar 27, 2026

    @github-actions
    github-actionsBot
    on Mar 27, 2026 – with GitHub Actions
    Contributor
    More actions

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

  5. github-actions
    closed this as completedon Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @rekram1-node
    rekram1-node

Labels

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

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.