Finding a VS Code Memory Leak
9 hours ago
- #memory-leak
- #VS-Code
- #Windows
- A memory leak in VS Code was discovered in 2021, consuming around 64 GB initially with no upper limit.
- The leak was invisible in Task Manager and found by someone who had never used VS Code.
- Discovery occurred during a pair-programming session when unusual seven-digit process IDs were noticed.
- Windows process IDs (PIDs) are multiples of four; high PIDs indicated a process-handle leak.
- A missing CloseHandle call in VS Code's code led to the leak, wasting ~64 KiB per leaked handle.
- The bug was quickly fixed after being reported, highlighting the importance of proper resource management.
- Suggests implementing resource limits in software to automatically detect and prevent such leaks.