Hi,<BR><BR>This may be Classic ASP thinking in the wonderful new .NET world, but it has occurred to me that I am creating loads of objects in my .NET code, and hardly ever close them or set them to nothing. Back in classic asp days this often meant you were creating an unnecessary (and ever-increasing) server load.<BR><BR>For example, in this sub I instantiate a business object to see if an item with a certain ID exists in the database:<BR><BR>+++++++++++++++++++++++++++++++<B R>EXAMPLE ONE - objItem<BR>+++++++++++++++++++++++++++++++<BR><BR> Sub bla bla bla...<BR> dim objItem as new BusinessObjects.Item<BR> if objItem.ItemExists(iItemID) then<BR> ucMessage.DisplayExistingMessageDetails(objItem.Ge tDetails(iItemID))<BR> else<BR> ucMessage.Visible = false<BR> TEMPLABEL.Text = "there&#039;s no item with this ItemID!"<BR> end if<BR>End sub<BR><BR><BR>But what happens to this objItem when I don&#039;t need it any more? Does it stay in server memory forever and ever, does it get destroyed at "end Sub", or when the page is re-loaded, or what?<BR><BR><BR>And in the example below, my OleDbCommand object "objCmd" is opened, but never closed. Does it close automatically when I close objReader, or should I be destroying it myself?<BR><BR><BR>+++++++++++++++++++++++++++++++ <BR>EXAMPLE TWO - objCmd<BR>+++++++++++++++++++++++++++++++<BR><BR>P ublic Function GetItemType(ItemID as Integer) as Integer<BR>Dim objConn as New OleDbConnection ( ConfigurationSettings.AppSettings("ConnectionStrin g") )<BR>dim objCmd as new OleDbCommand ( "SELECT tblItems.ItemTypeID from tblItems WHERE ItemID = " & ItemID, objConn )<BR>dim objReader as OleDbDataReader<BR> try<BR> objCmd.Connection.Open()<BR> &#039;*** I never seem to close this connection!!!!!!!!<BR> objReader = objCmd.ExecuteReader<BR> catch ex as OleDbException<BR> throw ex<BR> Return -1 <BR> end try<BR>while objReader.Read()<BR> Return objReader.GetInt32(0)<BR>end while<BR>objReader.Close<BR>End function<BR><BR><BR>Are there some general rules about object disposal I should know about?<BR><BR>Thanks in advance for any pearls of wisdom,<BR><BR>JON