php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71196 Memory leak with out-of-order live ranges
Submitted: 2015-12-22 12:36 UTC Modified: 2015-12-22 22:50 UTC
From: bwoebi@php.net Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: master-Git-2015-12-22 (Git) OS: Irrelevant
Private report: No CVE-ID: None
 [2015-12-22 12:36 UTC] bwoebi@php.net
Description:
------------
Outputting live ranges gives me:

LIVE RANGES:
        6: L6 - L7
(tmp/var)
        3: L2 - L9

Now, if there is an exception thrown between opline 2 and 5, http://lxr.php.net/xref/PHP_MASTER/Zend/zend_execute.c#2586 has a condition with a break;, hence cleanup won't be done for temporary 3 (the array).

Removing that break; fixes it, but maybe there is a better fix?

Test script:
---------------
try  {
        $a = "1";
        [1, (y().$a.$a) . ($a.$a)];
} catch (Error $e) {
        var_dump($e->getMessage());
}

Actual result:
--------------
HashTable leaks:

[Tue Dec 22 13:21:38 2015]  Script:  '/Users/Bob/php-src-X/_'
Zend/zend_vm_execute.h(7076) :  Freeing 0x10BC5A360 (56 bytes), script=/Users/Bob/php-src-X/_
[Tue Dec 22 13:21:38 2015]  Script:  '/Users/Bob/php-src-X/_'
/Users/Bob/php-src-X/Zend/zend_hash.c(133) :  Freeing 0x10BC60A00 (264 bytes), script=/Users/Bob/php-src-X/_
=== Total 2 memory leaks detected ===


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-12-22 12:36 UTC] bwoebi@php.net
-Assigned To: +Assigned To: dmitry
 [2015-12-22 22:48 UTC] dmitry@php.net
Automatic comment on behalf of dmitry@zend.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=aa4a83fec75aa1fc192d762ad70d5c556dc9e29a
Log: Fixed bug #71196 (Memory leak with out-of-order live ranges)
 [2015-12-22 22:48 UTC] dmitry@php.net
-Status: Assigned +Status: Closed
 [2016-04-18 09:30 UTC] bwoebi@php.net
Automatic comment on behalf of dmitry@zend.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=aa4a83fec75aa1fc192d762ad70d5c556dc9e29a
Log: Fixed bug #71196 (Memory leak with out-of-order live ranges)
 [2016-07-20 11:34 UTC] davey@php.net
Automatic comment on behalf of dmitry@zend.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=aa4a83fec75aa1fc192d762ad70d5c556dc9e29a
Log: Fixed bug #71196 (Memory leak with out-of-order live ranges)
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Jul 30 09:01:24 2021 UTC