#24442 [Bgs]: Accessing ADO via COM results in rapid memory leak

From: Date: Wed, 02 Jul 2003 06:42:20 +0000
Subject: #24442 [Bgs]: Accessing ADO via COM results in rapid memory leak
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-43049@lists.php.net to get a copy of this message
ID: 24442 User updated by: modea at hush dot com Reported By: modea at hush dot com Status: Bogus Bug Type: COM related Operating System: Windows 2000 Server PHP Version: 4.3.2 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2003-07-01 13:27:53] sniper@php.net Expected. And btw. doing unset() does NOT free any memory in runtime. ------------------------------------------------------------------------ [2003-07-01 13:19:22] 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. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24442&edit=1

« previous php.bugs (#43049) next »