Open ahoppen opened 2 days ago
%TEMP% is cleaned by Storage Sense in Windows 10/11, which runs automatically when disk space is low by default (a lot less often than the Unix counterpart), but can be adjusted to Daily, Weekly, or Monthly by the user.
Shall we close this?
I didn’t know about Storage Sense but I definitely ran my machine out of disk-space with files in Temp
, gathering >200,000 temporary directories (might have been significantly more, that’s when it stopped counting) and rebooting didn’t fix it. Also, there was an issue about this in SourceKit-LSP (https://github.com/swiftlang/sourcekit-lsp/issues/1698). So, I think we can’t rely on Windows cleaning up Temp, like we do on Unix.
Related, swift-driver is leaking files as well: https://github.com/swiftlang/swift-driver/issues/1720
If you build a SwiftPM package on Windows, it creates a lock files for
workspace-state.json
andPackage.resolved
in a temporary directory but never deletes the lock file. On Unix systems, the lock files will eventually be cleaned up by the system removing files from the temporary directories but on Windows,AppData\Local\Temp
does not get cleaned by the system (as far as I can tell) and the lock files stay around until the user manually removes them.