|
The controversy over Nothing by
Charles Carroll
Rule #1: All objects
created with SET whatever=server.createobject("whatever")
need to be destroyed on that page, i.e.
set whatever=nothing
Rule #2: All objects
created with
SET
whatever=server.createobject("whatever")
should never be put in a session variable.
These two statements are the source of much controversy. I
would like to address the veracity of these statements and address the real truth of this
matter and why this truth is important to building high traffic websites.
The session is issue is dealt with
in:
http://www.learnasp.com/freebook/asp/sessionoverview.aspx
http://www.learnasp.com/freebook/asp/globalproblems.aspx
http://www.learnasp.com/freebook/asp/buildvbthreads.aspx
http://www.learnasp.com/freebook/asp/nosessionobjects.aspx
Scenario #1:
set x=server.createobject("whatever.whatever")
....
set x=nothing
Scenario #2
set x=server.createobject("whatever.whatever")
....
In Scenario #1, I can guarantee
In Scenario #2, I cannot guarantee:
-
that the object WAS cleared from
memory
(I am basing this on a promise in the MS docs, and that the IIS code
internally is flawless). IIS is good but if you think it is flawless I would
like to ask you to buy some undervalued land in Florida.
-
when the object was cleaned from
memory (the docs do not say when garbage collection occurs)
I will also state that large ISPs (Innerhost,
DataReturn) will guarantee your webserver will come down several times a day or
week with scenario #2 (depending on how many objects are created throughout the
day). With Scenario #1 the webserver stays up without incident. This evidence
indicates the IIS garbage collection screws up.
 |  |  |
 |
There are many worthy charities!!. But perhaps help starving children in Africa or South America AND help Charles too.
a $5 tip buys him lunch at McDonalds,
a $20 tip buys his kid Hitoshi a new computer game,
a $39 tip buys his daughter Michiko a few nice outfits.
See our donor list.
|  |
 |  |  |
|
|
|
|