Re: Revisiting an old friend: Set oRS = Nothing
From: Bob Barrows [MVP] (reb01501_at_NOyahoo.SPAMcom)
Date: 05/05/04
- Next message: Dave Anderson: "Re: Revisiting an old friend: Set oRS = Nothing"
- Previous message: Ping: "SoapClient Call"
- In reply to: Dave Anderson: "Revisiting an old friend: Set oRS = Nothing"
- Next in thread: Chris Hohmann: "Re: Revisiting an old friend: Set oRS = Nothing"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 5 May 2004 15:08:10 -0400
Dave Anderson wrote:
> Last September, some of us engaged in a discussion of freeing
> resources in ASP scripts written in JScript. It can be seen here:
> http://tinyurl.com/2flzt
>
> I recently read Eric Lippert's article on the use of *Nothing*
> assignments in VB
> (http://blogs.msdn.com/ericlippert/archive/2004/04/28/122259.aspx)
> right before going out of scope, and was shocked by what he had to
> say, and I must say it has me curious about the implications for ASP,
> whether written in JScript or VBScript.
>
> Like Lippert, I have seen a lot of documentation/advice that suggests
> a need for such assignments, but little empirical evidence that it
> matters. I do not mean to suggest that *Nothing* assignments are
> NEVER required, I simply wonder if anyone has bothered to check if it
> still matters with recent generations of IIS and such common tools as
> ADO or CDO.
>
> Comments?
I don't understand your point. The consensus of most of the people on that
page is that ADO objects should be explicitly destroyed, especially in ASP.
The comments about bugs caused by failure to explicitly destroy ADO and DAO
objects should not be taken lightly.
In the many years that I have been coding, the documentation for every
version of VB/VBA that I have used has ALWAYS said: objects are destroyed
when they go out of scope. Nevertheless, we came across memory leaks, bugs,
etc, which were resolved by explicitly destroying the objects in question.
This has always suggested to me that the documentation has always been
wrong: there are circumstances where the auto-cleanup failed, which lead to
many authors adding the "if you open it, close it; if you create it, destroy
it" mantra to their "best practices" lists. It was not makework. There are
many documented failures caused by non-adherence to this principle. Several
of those failures are mentioned in your cited blog.
For me, it's easier to remember to destroy all objects, than to remember to
destroy just my ADO objects.
Bob Barrows
-- Microsoft MVP -- ASP/ASP.NET Please reply to the newsgroup. The email account listed in my From header is my spam trap, so I don't check it very often. You will get a quicker response by posting to the newsgroup.
- Next message: Dave Anderson: "Re: Revisiting an old friend: Set oRS = Nothing"
- Previous message: Ping: "SoapClient Call"
- In reply to: Dave Anderson: "Revisiting an old friend: Set oRS = Nothing"
- Next in thread: Chris Hohmann: "Re: Revisiting an old friend: Set oRS = Nothing"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|