Bug #67610 [Ver->Csd]: Memory leak on zts debug build

From: Date: Sun, 27 Mar 2016 20:16:57 +0000
Subject: Bug #67610 [Ver->Csd]: Memory leak on zts debug build
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200168@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67610&edit=1 ID: 67610 Updated by: nikic@php.net Reported by: hylent at qq dot com Summary: Memory leak on zts debug build -Status: Verified +Status: Closed Type: Bug Package: Scripting Engine problem Operating System: centos PHP Version: 5.4.30 -Assigned To: +Assigned To: nikic Block user comment: N Private report: N New Comment: This has been fixed in PHP 7.1. The fix will not be ported to older versions as it involves complex compiler changes. Previous Comments: ------------------------------------------------------------------------ [2014-07-14 16:36:13] aharvey@php.net Output: vagrant@vagrant-ubuntu-trusty-64:~/php-src/5.4$ ./sapi/cli/php /tmp/test.php exception 'Exception' in /tmp/test.php:4 Stack trace: #0 /tmp/test.php(11): Foo::bar() #1 {main} [Mon Jul 14 16:35:32 2014] Script: '/tmp/test.php' /home/vagrant/php-src/5.4/Zend/zend_vm_execute.h(3674) : Freeing 0x7FFCC0430CA0 (32 bytes), script=/tmp/test.php [Mon Jul 14 16:35:32 2014] Script: '/tmp/test.php' /home/vagrant/php-src/5.4/Zend/zend_vm_execute.h(3737) : Freeing 0x7FFCC0433C60 (72 bytes), script=/tmp/test.php /home/vagrant/php-src/5.4/Zend/zend_API.c(982) : Actual location (location was relayed) [Mon Jul 14 16:35:33 2014] Script: '/tmp/test.php' /home/vagrant/php-src/5.4/Zend/zend_hash.c(292) : Freeing 0x7FFCC0433D08 (64 bytes), script=/tmp/test.php /home/vagrant/php-src/5.4/Zend/zend_alloc.c(2539) : Actual location (location was relayed) [Mon Jul 14 16:35:33 2014] Script: '/tmp/test.php' /home/vagrant/php-src/5.4/Zend/zend_vm_execute.h(3677) : Freeing 0x7FFCC0434110 (3 bytes), script=/tmp/test.php /home/vagrant/php-src/5.4/Zend/zend_variables.c(123) : Actual location (location was relayed) [Mon Jul 14 16:35:33 2014] Script: '/tmp/test.php' /home/vagrant/php-src/5.4/Zend/zend_hash.c(330) : Freeing 0x7FFCC04342B0 (74 bytes), script=/tmp/test.php === Total 5 memory leaks detected === ------------------------------------------------------------------------ [2014-07-12 09:27:29] hylent at qq dot com Description: ------------ On thread-safe debug build, in a try-catch code block, when constructing a multidimensional array, in case that some value in the array throws exceptions, there will be memory leaks! Test script: --------------- <?php class Foo { public static function bar() { throw new Exception(); } } try { $a = array( 'a' => 'aa', 'b' => array( 'c' => Foo::bar(), ), ); } catch (Exception $e) { echo $e, PHP_EOL; } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67610&edit=1

« previous php.bugs (#200168) next »