Memory Leak DLLHOST.EXE - Access Database

Results 1 to 3 of 3

Thread: Memory Leak DLLHOST.EXE - Access Database

  1. #1
    Join Date
    Dec 1969

    Default Memory Leak DLLHOST.EXE - Access Database

    When I access a certain part of ASP script the DLLHOST.EXE process is increasing by about 10Mb. I&#039;ve discovered the part of the script that is causing the memory leak and can&#039;t understand why. It seems to happen when an access database is opened and then closed.<BR><BR>The code starts :-<BR><BR>Set oConnection = Server.CreateObject( "ADODB.Connection" )<BR> Set oRecordSet = Server.CreateObject( "ADODB.Recordset" )<BR><BR> oConnection.ConnectionString = "IDData"<BR><BR> If oConnection.State = adStateClosed Then<BR> oConnection.Open<BR> end if<BR><BR> oRecordSet.Open sTableName, oConnection, adOpenForwardOnly, , adCmdTable<BR><BR>And ends :-<BR><BR>If oConnection.State &#060;&#062; adStateClosed Then<BR> oRecordSet.Close<BR> oConnection.Close<BR> end if<BR><BR> Set oConnection = Nothing<BR> Set oRecordSet = Nothing<BR><BR>Having read a number of articles, they seem to suggest that the memory leak is caused by not setting the object to Nothing at the end.<BR><BR>Does anyone know of any other cause?

  2. #2
    Join Date
    Dec 1969

    Default Hmmm

    &nbsp;<BR><BR>Set oConnection = Server.CreateObject( "ADODB.Connection" ) <BR>Set oRecordSet = Server.CreateObject( "ADODB.Recordset" ) <BR><BR>oConnection.ConnectionString = "IDData" <BR><BR>&#039; this can never be true. you just created the object<BR>&#039; above and never opened the connection.<BR><BR>If oConnection.State = adStateClosed Then <BR> oConnection.Open <BR>end if <BR><BR>&#039; What if the connection errored and didn&#039;t open?<BR><BR>oRecordSet.Open sTableName, oConnection, adOpenForwardOnly, , adCmdTable <BR><BR>And ends :- <BR><BR>If oConnection.State &#060;&#062; adStateClosed Then <BR> oRecordSet.Close <BR> oConnection.Close <BR>end if <BR><BR>Set oConnection = Nothing <BR>Set oRecordSet = Nothing <BR><BR> Try this:<BR><BR>Set oConnection = Server.CreateObject("ADODB.Connection") <BR><BR> oConnection.Open "IDData" <BR> <BR>If oConnection.State = adStateOpen Then <BR> <BR> Set oRecordSet = Server.CreateObject( "ADODB.Recordset" ) <BR> <BR> oRecordSet.Open sTableName, oConnection, adOpenForwardOnly, , adCmdTable <BR><BR>end if<BR><BR>on error resume next <BR> <BR> oRecordSet.Close <BR> oConnection.Close <BR> <BR>Set oRecordSet = Nothing<BR>Set oConnection = Nothing <BR> <BR>also, are you sure your are always closing your connections<BR>and destroying your objects "before" response.redirect to another page?<BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default RE: Memory Leak DLLHOST.EXE - Access Database

    some info maybe.<BR><BR>We had an issue with a leak. After doing a lot of testing we found that there was no problem on some server machines and the leak occuerd on others. It was an MDAC bug. There is some info on Microsoft&#039;s site about know trouble. To solve our problem we ended up put our query in a stored proceedure.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts