Bug #81027 [Nab]: WeakReference will cause memory leaks
| From: | nikic@php.net | Date: | Mon, 10 May 2021 15:15:05 +0000 |
| Subject: | Bug #81027 [Nab]: WeakReference will cause memory leaks | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-233766@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=81027&edit=1
ID: 81027
Updated by: nikic@php.net
Reported by: gy dot dlcs at gmail dot com
Summary: WeakReference will cause memory leaks
Status: Not a bug
Type: Bug
Package: Unknown/Other Function
Operating System: Linux
PHP Version: 8.0.6
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
I can't reproduce this.
Previous Comments:
------------------------------------------------------------------------
[2021-05-10 14:58:47] cmb@php.net
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
------------------------------------------------------------------------
[2021-05-10 14:09:11] gy dot dlcs at gmail dot com
php 7.4 and 8.0 will be affected
------------------------------------------------------------------------
[2021-05-10 14:04:46] gy dot dlcs at gmail dot com
Description:
------------
Just like the test script, When you Uncomment the
!$wr->get(); line, You will see
the memory leaks in a few seconds.
Test script:
---------------
<?php
ini_set('memory_limit', '16M');
while (true) {
$a = new stdClass();
$a->a = $a;
$wr = WeakReference::create($a);
unset($a);
// Uncomment next line, memory will not leak
// $wr->get();
// Uncomment next line, memory will leak
// !$wr->get();
}
Expected result:
----------------
PHP Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 20480 bytes) in
test.php on line 9
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81027&edit=1