Our application has recently started creating (and not cleaning up) temp files at a pretty high rate (though it still takes a couple of days of high use to choke our CI servers when we run out of temp file names). It’s a large application with a large team working on it, so the issue is hard to track down by reviewing commits. Is there a good way to diagnose this sort of problem?
A couple of extra things I’ve noticed (though they have not gotten me anywhere yet):
- The “leaked” temp files show up in c:\windows\temp, regardless of what %temp% is set to
- They are always empty, as though someone gets them and does nothing
Finally, we recently started using sqlite to store some files locally instead of using the file system directly. A little searching suggests that SQLite writes some temp files there, but all the forum posts suggest they are massive, where I have 0 bytes files. Anyone have an experience with SQLite creating a problem like this?
The method that is most likely the issue is Path.GetTempFileName. Check out if all calls to it delete the resulting temprory file.