Options

Lots of .tmp files left behind

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

Comments

  • Options
    Are you disposing all Database objects etc etc when you finish with them? It's possible for your SDK application to leave a lot of temporary files lying around if you don't obsessively dispose everything when you're done with it :).
    Software Developer
    Redgate Software
  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Thanks for your question.

    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.
  • Options
    Are you disposing all Database objects etc etc when you finish with them? It's possible for your SDK application to leave a lot of temporary files lying around if you don't obsessively dispose everything when you're done with it :).

    We've checked our code and we're pretty confident that we are using 'using' every time (checked with FxCop to be sure).

    -dave
  • Options
    Are new temporary files left behind after every normal run, or are they only occasionally created?
  • Options
    Are new temporary files left behind after every normal run, or are they only occasionally created?

    The times of the files seem to correspond pretty closely to our automated build times, so I'd say "every time".

    -dave
  • Options
    Would it be possible to pm me the relevant sections of code? or email me with my login at redgate.com
Sign In or Register to comment.