Fix OOM issues during code indexing for large Swift files #5712
+444
−71
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR resolves Out of Memory (OOM) issues that occur when indexing codebases containing large Swift files.
Problem
Issue #5711 reported OOM errors during code indexing when processing Swift, Go, and C code. The issue specifically mentioned complaints about Swift language processing followed by memory issues.
Root Causes Identified
Solution
Memory Monitoring System
MemoryMonitorutility class for tracking memory usage and pressureSwift-Specific Optimizations
Parser Optimizations
Scanner Improvements
Testing
Files Changed
src/services/code-index/constants/index.ts- Added memory-related constantssrc/services/code-index/utils/memoryMonitor.ts- New memory monitoring utilitysrc/services/code-index/processors/parser.ts- Memory optimizations and Swift handlingsrc/services/code-index/processors/scanner.ts- Memory monitoring during scanningsrc/services/code-index/utils/__tests__/memoryMonitor.spec.ts- Test coverageFixes #5711
Important
Fixes OOM issues during code indexing for large Swift files by implementing memory monitoring and optimizations.
parser.tsandscanner.ts.parser.tsandscanner.ts.MemoryMonitorclass inmemoryMonitor.tsfor tracking memory usage and pressure.memoryMonitor.spec.tswith comprehensive tests forMemoryMonitorfunctionality.constants/index.ts.This description was created by
for 7e3ad68. You can customize this summary. It will automatically update as commits are pushed.