Lots of .tmp files left behind
flcdrg
Posts: 17 Bronze 2
We're using the SDK components on our build server, but I've noticed that they seem to be leaving behind lots of undeleted tmp files.
Specifically, the folder
C:\Documents and Settings\<buildaccount>\Local Settings\Temp\Red Gate
currently has over 15,000 .tmp files in it, which seem to correspond roughly to when we've run our database unit tests (which use the red-gate SDK to rebuild the database for each test).
Each file appears to be a binary file, and has a guid-like filename, with the .tmp suffix.
Is there something we need to do to clean up these files, or is this just a bug that Red Gate need to fix?
-dave
Specifically, the folder
C:\Documents and Settings\<buildaccount>\Local Settings\Temp\Red Gate
currently has over 15,000 .tmp files in it, which seem to correspond roughly to when we've run our database unit tests (which use the red-gate SDK to rebuild the database for each test).
Each file appears to be a binary file, and has a guid-like filename, with the .tmp suffix.
Is there something we need to do to clean up these files, or is this just a bug that Red Gate need to fix?
-dave
Comments
Redgate Software
Typically these temporary files are cleaned up as part of the Dispose() method of the objects you're using. Generally, any object that implements Dispose() should have Dispose() called on it, for instance the Database object will leave an entire snapshot of a database schema behind in the temporary files folders unless it's disposed when you're done with it.
I think that any temporary files are cleaned up if you put the object (eg Database) in a using block as well, if you only need the object briefly.
There may be some problems cleaning up, however, if there are any crashes happening in your program. .NET 2.0 employs a "critical finalizer" to clean up objects that implement IDisposable which may or may not do the job.
We've checked our code and we're pretty confident that we are using 'using' every time (checked with FxCop to be sure).
-dave
The times of the files seem to correspond pretty closely to our automated build times, so I'd say "every time".
-dave