G
Gman
Hi NG,
I have a VB app that connects thru ADO to an Access DB. While performing
pretty heavy testing I have noticed that my memory usage increases -
after, say, 1000 queries my application's memory consumption may go from
20MB to 40MB.
I use one connection to connection to the database, persisting the
connection between queries. If I close the connection after every query
then this cures the creep - but I don't want to take this hit in
performance.
There is an MS KB article that mentions a similar issue:
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q247140
but says it is cured in Jet SP6 - I have SP8 (4.0.8618.0)
Is there something else I can do to tidy up after querying w/o closing
the connection - I'm already closing the record set, setting it to nothing?
Thanks for any suggestions.
Gman
FYI
I connect as follows:
Using objects with module scope
Private m_rs New ADODB.Recordset
Private m_cn As New ADODB.Connection
I use one function to make the connection then a second function that
retrieves a query's results and places them into a variant (function
tidied up for brevity - error trapping removed for instance):
Function RunQuery(mySQL as string) as variant
With m_rs
.ActiveConnection = m_cn
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockReadOnly
.Open mySQL
'Dump the record set into an array
If .RecordCount = 0 Then
ADO_RunQuery = False
Else
ADO_RunQuery = .GetRows
End If
.Close
End With
'tidy up
Set m_rs = Nothing
End Function
I have a VB app that connects thru ADO to an Access DB. While performing
pretty heavy testing I have noticed that my memory usage increases -
after, say, 1000 queries my application's memory consumption may go from
20MB to 40MB.
I use one connection to connection to the database, persisting the
connection between queries. If I close the connection after every query
then this cures the creep - but I don't want to take this hit in
performance.
There is an MS KB article that mentions a similar issue:
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q247140
but says it is cured in Jet SP6 - I have SP8 (4.0.8618.0)
Is there something else I can do to tidy up after querying w/o closing
the connection - I'm already closing the record set, setting it to nothing?
Thanks for any suggestions.
Gman
FYI
I connect as follows:
Using objects with module scope
Private m_rs New ADODB.Recordset
Private m_cn As New ADODB.Connection
I use one function to make the connection then a second function that
retrieves a query's results and places them into a variant (function
tidied up for brevity - error trapping removed for instance):
Function RunQuery(mySQL as string) as variant
With m_rs
.ActiveConnection = m_cn
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockReadOnly
.Open mySQL
'Dump the record set into an array
If .RecordCount = 0 Then
ADO_RunQuery = False
Else
ADO_RunQuery = .GetRows
End If
.Close
End With
'tidy up
Set m_rs = Nothing
End Function