ID: 48141 Updated by: tony2...@php.net Reported By: greg at chiaraquartet dot net -Status: Open +Status: Assigned Bug Type: Scripting Engine problem Operating System: ubuntu linux PHP Version: 5.3CVS-2009-05-04 (CVS) -Assigned To: +Assigned To: dmitry New Comment:
Dmitry, could you look into it? Previous Comments: ------------------------------------------------------------------------ [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: -------------- u...@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