mirror of
https://github.com/php/php-src.git
synced 2026-03-30 04:02:19 +02:00
Merge branch 'PHP-7.4'
This commit is contained in:
19
Zend/tests/bug78589.phpt
Normal file
19
Zend/tests/bug78589.phpt
Normal file
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug #78589: Memory leak with GC + __destruct()
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Test {
|
||||
public function __destruct() {}
|
||||
}
|
||||
|
||||
$test = new Test;
|
||||
$test->foo = [&$test->foo];
|
||||
$ary = [&$ary, $test];
|
||||
unset($ary, $test);
|
||||
gc_collect_cycles();
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
||||
@@ -1539,7 +1539,6 @@ ZEND_API int zend_gc_collect_cycles(void)
|
||||
|
||||
/* Destroy zvals */
|
||||
GC_TRACE("Destroying zvals");
|
||||
GC_G(gc_protected) = 1;
|
||||
current = GC_IDX2PTR(GC_FIRST_ROOT);
|
||||
last = GC_IDX2PTR(GC_G(first_unused));
|
||||
while (current != last) {
|
||||
@@ -1590,7 +1589,6 @@ ZEND_API int zend_gc_collect_cycles(void)
|
||||
|
||||
GC_TRACE("Collection finished");
|
||||
GC_G(collected) += count;
|
||||
GC_G(gc_protected) = 0;
|
||||
GC_G(gc_active) = 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user