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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rs.close and set rs=nothing 1

Status
Not open for further replies.

Microbe

Programmer
Oct 16, 2000
607
AU
In a discussion recently the topic of trashing objects when you are finished with them came up.

This person was pretty adamant that after finishing with a recordset or setting any object that it should all clean up with

objectvar.close()
set (objectvar) = nothing

His argument was that if do something like this:

set rs= Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = MM_SQLSERVER_STRING
rs.Source = "SELECT * FROM reallybigdatabase"
rs.Open

and (say) 100 people do the same thing and all the objects are left hanging then the server performace will be degraded.

Makes sense and I am getting into the habit of closing and nuking the object, but I notice that Dreamweaver UltraDev doesn't do "set rs=nothing" after it creates the "rs.close()" code.

Not that they are perfect, but I would have thought it was something theyw ould do if it was important.

Any thoughts?????? Steve Davis
hey.you@hahaha.com.au
 
setting rs=nothing deallocates the memory assigned to the object. rs.close() does not.

More memory available on your server == very good thing

Don't ever fall into the assumption that just because a WYSIWIG editor doesn't do something, then it doesn't need to be done. It's a very bad assumption.

It's good programming practice, and it is the convention. Nothing more, nothing less.
penny.gif
penny.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top