Microsoft KB Archive/314637

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

Article ID: 314637

Article Last Modified on 11/4/2003

-

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

-



This article was previously published under Q314637



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.



Steps to Reproduce Behavior
  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;   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 &quot;Provider=MSDAORA;Data Source=MyOracleDataSource;&quot;, &quot;MyUser_Name&quot;, &quot;MyPassword&quot; Set cmd.ActiveConnection = cn   cmd.CommandType = adCmdText cmd.CommandText = &quot;{call packperson.allperson(?,{resultset 500,SSN,FNAME,LNAME},?)}&quot; cmd.Parameters.Append cmd.CreateParameter(&quot;DUMMY&quot;, adInteger, adParamInput, 4, 0) cmd.Parameters.Append cmd.CreateParameter(&quot;DUMMY_OUT&quot;, adInteger, adParamOutput, 0) Set rs = cmd.Execute rs.Close cn.Close Set rs = Nothing Set cn = Nothing Set cmd = Nothing End Sub  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.

Additional query words: Oracle MSDAORA

Keywords: kbbug kbfix kboracle kbqfe KB314637

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.