Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Problem Open Object

Reply
Thread Tools

Problem Open Object

 
 
stuart
Guest
Posts: n/a
 
      07-20-2005
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
 
Reply With Quote
 
 
 
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      07-21-2005
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


"stuart" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: how to open a file in some application using Tkinter i am usingTKINTER to create GUI application i want to know how to open a worddocument in open office or any other applicatio Fredrik Lundh Python 1 01-09-2008 10:40 AM
Weakref problem: no way to get original object from proxy object? John Nagle Python 2 02-26-2007 06:34 AM
Object creation - Do we really need to create a parent for a derieved object - can't the base object just point to an already created base object jon wayne C++ 9 09-22-2005 02:06 AM
"Object reference not set to an instance of an object" problem prince -=nore=- ASP .Net 2 01-03-2005 03:56 PM
static problem? Object reference not set to an instance of an object Michael Meckelein ASP .Net 3 04-14-2004 01:52 PM



Advertisments