Problem Open Object

S

stuart

Hi,

I think I have a memory leak on a web site I built.
The site runs for 6 weeks or (getting slower after about 4-5 weeks) then
the site stops serving .asp pages (no probs with any other file type).

I think I have forgotten to destroy a recordset or connection , but I
cannot find any offending code.

Is there a function that I could use along the lines of: -

for Each object in openObjects

response.write object.Name

OR

object.close
set object = nothing

next

TIA

Stuart
 
R

Ray Costanzo [MVP]

No, unfortunately there is not. If you consistently name your ADO object
the same thing in all your pages, what you can do is create a file like
this:

<%

On Error Resume Next
yourADOObject.Close
If Err.Number = 0 Then
Call EmailAlert()
Set yourADOObject = Nothing
End If


Sub EmailAlert()
Dim o
Set o = CreateObject("CDO.Message")
o.From = "email address here"
o.To = "email address here"
o.Subject "Unclosed ADO Object"
o.TextBody = "Unclosed ADO object in " & Request.ServerVariables("URL")
o.Send
Set o = Nothing
End Sub

%>


And then use a good text editor, i.e. www.textpad.com, and use it to do a
global replace in your site to add a virtual include to all your ASP files
at the very EOF. If you have a popular site, you should start getting
e-mails telling you about pages with unclosed ADO objects. Of course, this
does assume that you consistently name your ADO objects the same thing...
This in no way is a perfect solution...

Ray at home
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top