Bug #71196 [Asn->Csd]: Memory leak with out-of-order live ranges

[email protected]
Newsgroups php.bugs
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=71196&edit=1

 ID:                 71196
 Updated by:         [email protected]
 Reported by:        [email protected]
 Summary:            Memory leak with out-of-order live ranges
-Status:             Assigned
+Status:             Closed
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   Irrelevant
 PHP Version:        master-Git-2015-12-22 (Git)
 Assigned To:        dmitry
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of [email protected]
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)


Previous Comments:
------------------------------------------------------------------------
[2015-12-22 12:36:33] [email protected]

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 ===



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=71196&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.