Skip to content

[GUI] Output concatenation creates unbounded string growth (memory leak) #60

@Vantalens

Description

@Vantalens

File: packages/gui/src/state/workspace.ts:62

Severity: High

Description:
Long-running workflow with streaming output: [existing.output, event.output, event.stream, event.text] concatenates repeatedly; each event appends to growing string, causing O(n²) memory allocation.

Code:

const output = [existing.output, event.output, event.stream, event.text].filter(Boolean).join('');

Failure Scenario:
Workflow runs for 10 minutes streaming 100KB/sec → 60MB of output → every event creates new 60MB+ string → O(n²) memory growth → browser OOM crash or severe performance degradation.

Suggested Fix:

  • Use rope data structure or append-only buffer
  • Limit output to last N characters (e.g., tail 100KB)
  • Implement virtual scrolling for output display

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingguiGUI/frontend related issueshigh-priorityHigh priority issuesjavascriptPull requests that update javascript code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions