#20999 [NEW]: memory leak when using DB interface
| From: | dinoklein at hotmail dot com | Date: | Fri, 13 Dec 2002 20:49:32 +0000 |
| Subject: | #20999 [NEW]: memory leak when using DB interface | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-11623@lists.php.net to get a copy of this message | ||
From: dinoklein@hotmail.com
Operating system: Linux 2.4
PHP version: 4.3.0RC3
PHP Bug Type: PEAR related
Bug description: memory leak when using DB interface
By running the code below, both the http process executing the script, and
the php binary (when run on the command line), grow in memory size. In the
case of the http module, the memory is not freed once the script has
terminated.
This happens when using MySQL as the backend, and with PgSQL.
This does not happen when I use the pg_* functions directly. I have not
tested mysql_*.
<?php
require 'DB.php';
function db_connect()
{
//$dsn = 'pgsql://dinoklein@unix+localhost/unicode';
$dsn = 'mysql://test@unix+localhost/test';
return DB::Connect($dsn);
}
header('Content-Type: text/html');
$db = db_connect();
$sql_ins = 'insert into ttable values (?)';
for ($i=0; $i<25000; $i++)
{
echo "doing $i\n";
$ret = $db->query($sql_ins, array("code $i"));
if (DB::isError($ret))
{
echo "error on insert\n";
break;
}
}
$db->disconnect();
?>
--
Edit bug report at http://bugs.php.net/?id=20999&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=20999&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=20999&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=20999&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=20999&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=20999&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=20999&r=support
Expected behavior: http://bugs.php.net/fix.php?id=20999&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=20999&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=20999&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=20999&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20999&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=20999&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=20999&r=isapi