FIX: Resetting ADO Parameter Object Properties in Loop Causes Memory Leak (295538)
The information in this article applies to:
- Microsoft Data Access Components 2.5
- Microsoft Data Access Components 2.5 SP1
- Microsoft Data Access Components 2.5 SP2
- Microsoft Data Access Components 2.6
- Microsoft Data Access Components 2.6 SP1
This article was previously published under Q295538 SYMPTOMS When you set the Size or Type property for an ADODB.Parameter object repeatedly, a memory leak may occur. WORKAROUND To work around the problem, only change the Value property of the Parameter object in the loop, not other properties such as Size and Type. For example, the code shown in the "Steps to Reproduce Behavior"
section can be rewritten as follows:
Parm.Type = adVarChar
Parm.Size = 11
While True
Parm.Value = "172-32-1176"<BR/>
' The following line will work around the memory leak as well.
' Set Cmd.ActiveConnection = Conn
Cmd.CommandText = "SP_AUTHOR_BY_ID"
Set Rst = Cmd.Execute
Rst.Close
Wend
Resetting the ActiveConnection property of the Command object before resetting the parameter information will work
around the memory leak. RESOLUTIONTo resolve this
problem, obtain the latest service pack for Microsoft Data Access Components
2.6. For additional information, click the following article number to view the
article in the Microsoft Knowledge Base: 300635 INFO: How to Obtain the Latest MDAC 2.6 Service Pack
STATUSMicrosoft
has confirmed that this is a problem in the Microsoft products that are listed
at the beginning of this article.
This problem was first
corrected in Microsoft Data Access Components 2.6 Service Pack
2.
Modification Type: | Minor | Last Reviewed: | 9/26/2005 |
---|
Keywords: | kbHotfixServer kbQFE kbbug kbfix kbmdac260sp2fix KB295538 kbAudDeveloper |
---|
|