Skip to content

Conversation

@hannesrudolph
Copy link
Collaborator

@hannesrudolph hannesrudolph commented Dec 30, 2025

Related to Roo-Code PR #7666 (terminal output memory retention), this audits the codebase indexing feature for similar long-lived retention and fixes two leak patterns:

  1. .rooignore watcher lifecycle
  • Avoid creating file watchers during one-shot directory scans.
  • Ensure ignore controller watchers are disposed when recreating/disposing the code index services.
  1. web-tree-sitter parse tree disposal
  • Ensure parse trees are deleted after use to prevent WASM heap growth.

Key changes:

  • src/core/ignore/RooIgnoreController.ts: add watch option to skip watcher creation.
  • src/services/code-index/processors/scanner.ts: use watch:false and dispose in finally.
  • src/services/code-index/processors/file-watcher.ts + src/services/code-index/manager.ts: explicit ownership + disposal of shared RooIgnoreController.
  • src/services/code-index/processors/parser.ts + src/services/tree-sitter/index.ts: delete parse trees.

Tests:

  • Updated scanner/file-watcher/parser tests and added tree-sitter tree-disposal test.

Important

Fix memory leaks in code indexing by controlling file watcher creation and ensuring parse tree disposal.

  • Behavior:
    • Avoid creating file watchers during one-shot directory scans in RooIgnoreController.
    • Ensure RooIgnoreController watchers are disposed in manager.ts and file-watcher.ts.
    • Ensure parse trees are deleted after use in parser.ts and index.ts.
  • Options:
    • Add watch option to RooIgnoreController to control watcher creation.
  • Tests:
    • Update tests in file-watcher.spec.ts, parser.spec.ts, and scanner.spec.ts.
    • Add tree-disposal.spec.ts to test parse tree disposal.

This description was created by Ellipsis for 90f010f. You can customize this summary. It will automatically update as commits are pushed.

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Dec 30, 2025
@roomote
Copy link
Contributor

roomote bot commented Dec 30, 2025

Oroocle Clock   See task on Roo Cloud

Re-review complete (90f010f). No issues flagged in the latest changes.

  • No issues to resolve
Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Dec 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

2 participants