Lots of .tmp files left behind

Automate and integrate using the SQL comparison API

Moderator: Chris Auckland

Lots of .tmp files left behind

Postby flcdrg » Mon Feb 16, 2009 2:30 am

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
flcdrg
 
Posts: 12
Joined: Mon Feb 16, 2009 2:24 am

Postby Michelle Taylor » Mon Feb 16, 2009 12:10 pm

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 :).
Michelle Taylor
 
Posts: 529
Joined: Mon Oct 30, 2006 12:45 pm
Location: Red Gate Software

Postby Brian Donahue » Mon Feb 16, 2009 12:10 pm

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.
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am

Re:

Postby flcdrg » Tue Mar 10, 2009 4:13 am

Michelle Taylor wrote: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
flcdrg
 
Posts: 12
Joined: Mon Feb 16, 2009 2:24 am

Postby simon.jackson » Fri Mar 13, 2009 2:38 pm

Are new temporary files left behind after every normal run, or are they only occasionally created?
simon.jackson
 
Posts: 45
Joined: Thu Jan 08, 2009 10:42 am

Re:

Postby flcdrg » Sun Mar 15, 2009 11:56 pm

simon.jackson wrote: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
flcdrg
 
Posts: 12
Joined: Mon Feb 16, 2009 2:24 am

Postby simon.jackson » Tue Mar 17, 2009 12:52 pm

Would it be possible to pm me the relevant sections of code? or email me with my login at redgate.com
simon.jackson
 
Posts: 45
Joined: Thu Jan 08, 2009 10:42 am


Return to SQL Comparison SDK Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests