Microsoft Knowledge Base Email Alertz

(314637) - The Microsoft OLE DB Provider for Oracle may leak memory when used to execute a stored procedure against Oracle that returns extra output parameters after a result set.

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 314637 - Last Review: November 4, 2003 - Revision: 2.2

FIX: Oracle OLE DB Provider May Leak Memory When Executing Certain Stored Procedures

This article was previously published under Q314637

On This Page

SYMPTOMS

The Microsoft OLE DB Provider for Oracle may leak memory when used to execute a stored procedure against Oracle that returns extra output parameters after a result set.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.  This bug was corrected in Microsoft Data Access Components (MDAC) 2.7.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Execute the following script to create a sample table and stored procedure in an Oracle database:
    DROP TABLE person;
    
       CREATE TABLE person
        (ssn     NUMBER(9) PRIMARY KEY,
         fname   VARCHAR2(15),
         lname   VARCHAR2(20));
    
       INSERT INTO person VALUES(555662222,'Sam','Goodwin');
    
       INSERT INTO person VALUES(555882222,'Kent','Clark');
    
       INSERT INTO person VALUES(666223333,'Jane','Doe');
    
       COMMIT;
        / 
    CREATE OR REPLACE PACKAGE packperson
         AS
           TYPE tssn is TABLE of  NUMBER(10)
           INDEX BY BINARY_INTEGER;
           TYPE tfname is TABLE of VARCHAR2(15)
           INDEX BY BINARY_INTEGER;
           TYPE tlname is TABLE of VARCHAR2(20)
           INDEX BY BINARY_INTEGER;
    
           PROCEDURE allperson
                   (param1 IN NUMBER,
    	  ssn    OUT     tssn,
                    fname  OUT     tfname,
                    lname  OUT     tlname,
    	 param2  OUT  NUMBER);
       END packperson;
    / 
    
       CREATE OR REPLACE PACKAGE BODY packperson
       AS
    
       PROCEDURE allperson
                  (param1 IN NUMBER,
    	  ssn    OUT     tssn,
                    fname  OUT     tfname,
                    lname  OUT     tlname,
    	 param2  OUT  NUMBER)
      
       IS
           CURSOR person_cur IS
                   SELECT ssn, fname, lname
                   FROM person;
    
           percount NUMBER DEFAULT 1;
    
       BEGIN
           FOR singleperson IN person_cur
           LOOP
                   ssn(percount) := singleperson.ssn;
                   fname(percount) := singleperson.fname;
                   lname(percount) := singleperson.lname;
                   percount := percount + 1;
           END LOOP;
           param2:=param1;
       END;
    END;
    					
  2. Insert the following code into the form code for a new Microsoft Visual Basic 6.0 Data Project:
    Private Sub Form_Load()
        While True
            LeakDemo
        Wend
    End Sub
    
    Private Sub LeakDemo()
        Dim cn As New ADODB.Connection
        Dim rs As New ADODB.Recordset
        Dim cmd As New ADODB.Command
        
        cn.Open "Provider=MSDAORA;Data Source=MyOracleDataSource;", "MyUser_Name", "MyPassword"
        Set cmd.ActiveConnection = cn
        cmd.CommandType = adCmdText
        cmd.CommandText = "{call packperson.allperson(?,{resultset 500,SSN,FNAME,LNAME},?)}"
        cmd.Parameters.Append cmd.CreateParameter("DUMMY", adInteger, adParamInput, 4, 0)
        cmd.Parameters.Append cmd.CreateParameter("DUMMY_OUT", adInteger, adParamOutput, 0)
        
        Set rs = cmd.Execute
        rs.Close
        cn.Close
        Set rs = Nothing
        Set cn = Nothing
        Set cmd = Nothing
    End Sub
    					
  3. Use Performance Monitor to monitor the private bytes on the Visual Basic 6.0 process (or your executable process). You will notice a gradual, steady increase in the number of private bytes allocated for the process.

APPLIES TO
  • Microsoft Data Access Components 1.5
  • Microsoft Data Access Components 2.0
  • Microsoft Data Access Components 2.1
  • Microsoft Data Access Components 2.5
  • Microsoft Data Access Components 2.6
  • Microsoft Data Access Components 2.6 Service Pack 1
  • Microsoft OLE DB Provider for Oracle Server 1.0
  • Microsoft Data Access Components 2.6 Service Pack 2
  • Microsoft OLE DB Provider for Oracle Server 1.0
  • Microsoft OLE DB Provider for Oracle Server 1.0
  • Microsoft OLE DB Provider for Oracle Server 1.0
Keywords: 
kbbug kbfix kboracle kbqfe KB314637
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate