|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-05-04 08:03 UTC] tony2001@php.net
[2009-05-04 10:16 UTC] dmitry@php.net
[2009-05-04 17:21 UTC] cellog@php.net
[2009-05-04 17:22 UTC] cellog@php.net
[2009-05-06 18:49 UTC] jani@php.net
[2009-05-14 01:00 UTC] php-bugs at lists dot php dot net
[2009-12-15 00:44 UTC] felipe@php.net
[2009-12-22 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 19:00:01 2025 UTC |
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 ===