|
|
 |
RE: FN-FORUM: Dedicated Windows Managed Server?
date posted 22nd April 2008 17:21
Colin wrote:
> I know it's a pain, but well worth the time spent as after sorting =
this=20
> out on every page, most of the problems disappeared, upon further=20
> investigation it turns out that unless you close the recordsets and=20
> connections like this they remain in memory until they timeout.
Mmmm .. I'm reasonably certain from reading MS documentations that ADO
Connection and Recordset objects - like any other ASP object - will
automatically be destroyed when the page finishes. The only exception =
that I
am aware of is if the code is explicitly storing a reference to an ADO
object in an Application / Session variable (which is a bad idea anyway, =
due
to threading issues).
There shouldn't therefore be any benefit to blindly adding "Close" calls =
to
the end of every page. What CAN help scalability is to call "Close" on =
the
Recordset/Connection as soon as it is no longer needed. If this is done
half-way through the page, before a bout of processing that doesn't need =
the
RS/connection, this will free up resources quicker.
Readers interested in optimising classic ASP ADO should also Google
[disconnected ADO recordsets] (faster than connected recordsets for
read-only access) and [ADO GetRows] for a technique for converting a
Recordset to a VBScript array, which is quicker to navigate than cycling
through the RS.
General reading:
MSDN - 25+ ASP Tips to Improve Performance and Style
http://msdn2.microsoft.com/en-us/library/ms972335.aspx
- Warning: ignore tip #18 (using ADO TypeLib instead of Const) -
this is completely incorrect, confirmed personally by the guy (Eric =
Lippert)
that programmed the feature!
Cheers, Ben
--
Ben Johnson, Neogic Web Solutions
// design . development . managed hosting
w | http://www.neogic.com
t | +44 (0)1242 808 262
e | [EMAIL REMOVED]
|
 |
|