FIX: Marshaling ADO Recordset Out-of-Process Causes Small Memory Leak

ID: Q230487


The information in this article applies to:


SYMPTOMS

When an ADO recordset is marshaled out-of-process from a COM server, a small leak in Private Bytes occurs in the COM server's process space.

This leak occurs when using either a disconnected ADO recordset or a recordset created with the RDS DataFactory.


CAUSE

The leak is caused by ADO internally making an incorrect call to AddRef() on a Stream pointer within MarshalInterface.


STATUS

A supported fix that corrects this problem is now available from Microsoft, but it has not been fully regression tested and should be applied only to systems experiencing this specific problem. If you are not severely affected by this specific problem, Microsoft recommends that you wait for the next Microsoft Data Access Components 2.1 SP2 that contains this fix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the fix. For a complete list of Microsoft Product Support Services phone numbers and information on support costs, please go to the following address on the World Wide Web:

http://support.microsoft.com/support/supportnet/default.asp
The English version of this fix should have the following file attributes or later:

Date Time Version Size File Name Platform
4/29/99 2.10.4029 850,944 Msadce.dll

NOTE: If this product was already installed on your computer when you purchased it from the Original Equipment Manufacturer (OEM) and you need this fix, please call the Pay Per Incident number listed on the above Web site. If you contact Microsoft to obtain this fix, and if it is determined that you only require the fix you requested, no fee will be charged. However, if you request additional technical support, and if your no-charge technical support period has expired, or if you are not eligible for standard no-charge technical support, you may be charged a non-refundable fee.

For more information about eligibility for no-charge technical support, see the following article in the Microsoft Knowledge Base:
Q154871 Determining If You Are Eligible for No-Charge Technical Support


MORE INFORMATION

Steps to Reproduce Behavior

  1. Create an Executable project in Visual Basic that will be the server application. Name the project LeakEXE, and within it, create a class module named LeakRS. Use the following code within the LeakRS class:
    
    Option Explicit
    
    Function GetRS() As ADODB.Recordset
    Dim rs As ADODB.Recordset
        
        On Error Resume Next
        Set rs = New ADODB.Recordset
        rs.Fields.Append "x", adInteger
        rs.Open
        rs.AddNew
        rs.Fields(0).Value = 1
        rs.Update
        rs.MoveFirst
        Set GetRS = rs
        
    End Function 


  2. Next, create a client project in Visual Basic, using the following code:
    
    
    Sub OutofProcLeak()
    Dim x As New LeakEXE.LeakRS
    Dim rs As ADODB.Recordset
    
    For i = 0 To 200000
        Set rs = x.GetRS
        Debug.Print Str(i)
        DoEvents
    Next
    
    Set rs = Nothing 


  3. Run the client application. Use the Windows NT Performance Monitor to watch Private Bytes counter for object Process using instance LeakEXE.exe.


Additional query words: ado rds out of process recordset memory leak small


Keywords          : kbADO210fix kbRDS210fix kbMDAC210fix 
Version           : WINDOWS:1.0,2.1 SP1
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: May 7, 1999