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

Closing the objects

Status
Not open for further replies.

denoxis

Programmer
Jul 22, 2002
154
US
Hi,

My server admin warned me about the server resources due to the high traffic. Two main thing, DLLHOST.EXE and INETINFO.EXE are the main resource eaters. He asked me to double check the site if there is any open objects that are not closed properly.

I do like this in my code, would it work:

function blah(etc)
set obj = server.createobject("someobj")
if etc something then
blah = this
else
blah = that
end if
set obj = nothing
end function

I return the function value, then set obj = nothing. I'm only 99% sure it works.

Another thing is, what if an error accured while an object is open. Would it be closed automatically by the system, or do I have to trap the error, and close everything if an error occur?

Thanks in advance.
 
denoxis:

You should always include an error handler on your asp page...eg:

On Error Resume Next

..do page processing here

if Err then
'set everything to nothing
'display error to user
end if

Also, you will have multiple instances of dllhost.exe on your server. This is the executable that calls the dll's. By default a dll remains in memory for 3 minutes. If idle for that amount of time, dllhost.exe will end. Otherwise it will remain in memory. As long as you are setting everything to nothing you should be ok.

Another question...are you using IIS 5.0 or IIS 4.0. IIS 5 is a lot better at managing resources than IIS 4. It seems that with IIS 4, it would allow you to have object open infinitely.

Hope this helps,
Patrick

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top