Red Gate forums :: View topic - Lots of .tmp files left behind
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Comparison SDK Previous Versions
SQL Comparison SDK Previous Versions forum

Lots of .tmp files left behind

Search in SQL Comparison SDK Previous Versions forum
Post new topic   Reply to topic
Jump to:  
Author Message
flcdrg



Joined: 16 Feb 2009
Posts: 12

PostPosted: Mon Feb 16, 2009 2:30 am    Post subject: Lots of .tmp files left behind Reply with quote

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
Back to top
View user's profile Send private message
Michelle Taylor



Joined: 30 Oct 2006
Posts: 525
Location: Red Gate Software

PostPosted: Mon Feb 16, 2009 12:10 pm    Post subject: Reply with quote

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 Smile.
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6577

PostPosted: Mon Feb 16, 2009 12:10 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
flcdrg



Joined: 16 Feb 2009
Posts: 12

PostPosted: Tue Mar 10, 2009 4:13 am    Post subject: Re: Reply with quote

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 Smile.


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

-dave
Back to top
View user's profile Send private message
simon.jackson



Joined: 08 Jan 2009
Posts: 45

PostPosted: Fri Mar 13, 2009 2:38 pm    Post subject: Reply with quote

Are new temporary files left behind after every normal run, or are they only occasionally created?
Back to top
View user's profile Send private message
flcdrg



Joined: 16 Feb 2009
Posts: 12

PostPosted: Sun Mar 15, 2009 11:56 pm    Post subject: Re: Reply with quote

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
Back to top
View user's profile Send private message
simon.jackson



Joined: 08 Jan 2009
Posts: 45

PostPosted: Tue Mar 17, 2009 12:52 pm    Post subject: Reply with quote

Would it be possible to pm me the relevant sections of code? or email me with my login at redgate.com
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group