#48141 [Asn]: memory leak in zend_execute.c and zend_operators.c
ID: 48141
Updated by: cellog@php.net
Reported By: greg at chiaraquartet dot net
Status: Assigned
Bug Type: Scripting Engine problem
Operating System: ubuntu linux
PHP Version: 5.3CVS-2009-05-04 (CVS)
Assigned To: dmitry
New Comment:
I'm using Ubuntu in a VMWare Fusion image in a MacBook Pro, in case
that is helpful
Previous Comments:
------------------------------------------------------------------------
[2009-05-04 17:21:17] cellog@php.net
user@ubuntu8041:~/workspace/php5$ cat config.nice
#! /bin/sh
#
# Created by configure
'./configure' \
'--enable-debug' \
'--with-zlib' \
'--with-bz2=shared' \
'--enable-cgi' \
"$@"
user@ubuntu8041:~/workspace/php5$ uname -a
Linux ubuntu8041 2.6.24-23-generic #1 SMP Wed Apr 1 21:47:28 UTC 2009
i686 GNU/Linux
user@ubuntu8041:~/workspace/php5$ cat CVS/Tag
TPHP_5_3
user@ubuntu8041:~/workspace/php5$
------------------------------------------------------------------------
[2009-05-04 10:16:39] dmitry@php.net
I'm not able to reproduce it with CVS PHP_5_3.
------------------------------------------------------------------------
[2009-05-04 08:03:17] tony2001@php.net
Dmitry, could you look into it?
------------------------------------------------------------------------
[2009-05-04 04:24:12] greg at chiaraquartet dot net
Description:
------------
When running a simple file that only instantiates objects using
autoload, there is a memory leak.
The leak appears to be caused by some combination of string
concatenation and exception throwing. The line that causes the leak is
in Pyrus/src/Pyrus/Registry/Sqlite3.php in the constructor:
if ($path && $path != ':memory:') {
if (dirname($path) . DIRECTORY_SEPARATOR . '.pear2registry'
!= $path) {
$path = $path . DIRECTORY_SEPARATOR .
'.pear2registry';
}
}
The line "$path = $path . DIRECTORY_SEPARATOR . '.pear2registry';"
leaks the value "/usr/local/lib/php/.pear2registry" on my machine, and
the zval allocated for $path.
Reproduce code:
---------------
<?php
// run from checkout of http://svn.pear.php.net/PEAR2/all
function __autoload($class)
{
if ($class == 'PEAR2_Exception') {
include __DIR__ . '/Exception/src/Exception.php';
return;
}
$class = str_replace('PEAR2_', '', $class);
$class = str_replace('_', '/', $class);
include __DIR__ . '/Pyrus/src/' . $class . '.php';
}
$a = PEAR2_Pyrus_Config::current();
Expected result:
----------------
no output
Actual result:
--------------
user@ubuntu8041:~/workspace/all/Pyrus/tests/AtomicFileTransaction/rmrf$
php -n test.phpt
[Sun May 3 22:58:31 2009] Script: 'test.phpt'
/home/user/workspace/php5/Zend/zend_execute.c(723) : Freeing
0xB7B52AE4 (20 bytes), script=test.phpt
[Sun May 3 22:58:31 2009] Script: 'test.phpt'
/home/user/workspace/php5/Zend/zend_operators.c(1231) : Freeing
0x088CE1EC (34 bytes), script=test.phpt
=== Total 2 memory leaks detected ===
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48141&edit=1
Thread (7 messages)