-
Notifications
You must be signed in to change notification settings - Fork 662
Open
Labels
Description
What
Memory leak in packages/cli/src/cli/cmd/run/execute.ts where the perFileIoLimiters Map grows indefinitely and is never cleared, causing unbounded memory accumulation across multiple translation runs.
Current behavior:
- Map uses lazy allocation: creates limiters on-demand when first accessed (lines 58-68)
- Map entries are never removed or cleared after task completion
- In watch mode or long-running processes, memory grows indefinitely
- Each unique bucket pattern adds a new Map entry that persists in memory
Expected behavior:
- Map should have fixed size based on number of unique bucket patterns
- Memory should be released after task completion
- No memory accumulation across multiple runs
Location: packages/cli/src/cli/cmd/run/execute.ts, lines 58-68
Current code:
const perFileIoLimiters = new Map<string, LimitFunction>();
const getFileIoLimiter = (bucketPathPattern: string): LimitFunction => {
const lockKey = bucketPathPattern;
if (!perFileIoLimiters.has(lockKey)) {
perFileIoLimiters.set(lockKey, pLimit(1)); // ❌ Unbounded growth
}
return perFileIoLimiters.get(lockKey)!;
};
please assign this to me