php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24442 Accessing ADO via COM results in rapid memory leak
Submitted: 2003-07-01 13:19 UTC Modified: 2003-07-02 01:42 UTC
From: modea at hush dot com Assigned:
Status: Not a bug Package: COM related
PHP Version: 4.3.2 OS: Windows 2000 Server
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: modea at hush dot com
New email:
PHP Version: OS:

 

 [2003-07-01 13:19 UTC] modea at hush dot com
Description:
------------
When using the COM interface to access MS SQL server via ADO (per client's stringent requirements), we're finding that the PHP executable's memory use is increasing very rapidly, quickly resulting in a failure to instantiate any more COM.

The COM is being called iteratively to load the data 100 rows at a time, so in some page loads the COM may be loaded and used up to 80 or 90 times.  As each pass completes, the ADO Connection and Recordset objects are closed, and the local variables are unset().  

We're finding that on our larger loads (the 80 to 90 COM loads), our memory consumption is increasing by as much as 9MB, whereas we'd expect an increase of nothing more than about 500k.  If we swap the ADO with the mssql_ libraries, the memory increase is as expected.

It takes about 40 such loads before COM fails to start.  At that time, the PHP executable occupies about 290MB of memory.

Reproduce code:
---------------
// simplified.  this is called in a loop 80x or more.

$dbc = new COM("ADODB.Connection") or die ("Connection create failure");

$dbostr = "-connection details-";
$dbc->Open($dbostr);
$RSet=$dbc->Execute("querystring");
//code to process rows in RSet
$RSet->close;
$dbc->close;
unset($RSet);
unset($dbc);


Expected result:
----------------
Would expect the memory to be properly cleaned after calling the close method for both objects and unset'ing the local variables.  The final data returned from this function is the same whether we use mssql_ or ADO, but with ADO the PHP exe's memory utilization increases much to rapidly.

Actual result:
--------------
Memory increase depends on size of result set.  With every 8,000-10,000 rows loaded, we usually lose about 10MB.  Once we hit ~290MB, ADO no longer instantiates, and we error out.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-01 13:27 UTC] sniper@php.net
Expected. And btw. doing unset() does NOT free any memory in runtime.

 [2003-07-02 01:42 UTC] modea at hush dot com
Expected?  It's expected that using COM will result in a debilitating memory leak?  If so, that's fine, I just need a clear acknowledgement of this to show my client.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 05:01:27 2024 UTC