Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disposing Objects

Status
Not open for further replies.

sjn78

Programmer
Feb 22, 2003
92
AU
Hi,

I am just wondering why you should dispose of any objects that are no longer in use. Does it free up memory or is it just good practice.

The same question applies to db connections. I can see how leaving a databse open could lock out other users, but for an app where only 1 person will be using the database at a time, is it necessary.

Thanks

Steve
 
Just good practice. But very advisable good practice. Never leave something open you don't need any more.

Craig
 
Probably not necessary on instrinsic types like Int, String, etc. But definitly do it on database types (SqlConnection, OleDbDataReader, etc) and things which act as wrappers around Win32 resources (Message Queuing, threads, etc.)

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top