Bug #79900 [Opn->Csd]: Memory leaks reported in zend_objects_new with zend.enable_gc=0
| From: | nikic@php.net | Date: | Wed, 29 Jul 2020 13:28:04 +0000 |
| Subject: | Bug #79900 [Opn->Csd]: Memory leaks reported in zend_objects_new with zend.enable_gc=0 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-228273@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79900&edit=1
ID: 79900
Updated by: nikic@php.net
Reported by: tandre@php.net
Summary: Memory leaks reported in zend_objects_new with
zend.enable_gc=0
-Status: Open
+Status: Closed
Type: Bug
Package: Scripting Engine problem
PHP Version: 8.0Git-2020-07-26 (Git)
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c206c742d6225c7f4c7ffbf95e33034d8de59047
Log: Fix bug #79900
Previous Comments:
------------------------------------------------------------------------
[2020-07-28 14:28:23] nikic@php.net
We should probably force-run GC on shutdown (in debug builds).
I don't think anything about the behavior here has actually changed, those leaks were probably
just suppressed by use of "exit" previously.
------------------------------------------------------------------------
[2020-07-26 22:56:25] tandre@php.net
Description:
------------
When gc is disabled, PHP builds containing --enable-debug report a variety of memory leaks during
PHP shutdown.
I'm not sure if this is reflective of an actual memory leak or whether this is a deliberate
change in php 8.0. It's distracting when trying to debug issues, though.
Many large applications disable gc because it has historically been slow in older php versions, e.g.
I noticed this when running composer and http://github.com/phan/phan/ (which creates objects with
reference cycles, e.g. Type to UnionType to the type itself.
For example, during --enable-debug, calling gc_collect_cycles() during shutdown may cut down on
noise about memory leaks, but that may itself be an inconsistency
```
» php run-tests.php -d zend.enable_gc=0 Zend/tests/bug61165.phpt --show-diff
=====================================================================
PHP : /path/to/php-8.0.0-debug-plain-install/bin/php
PHP_SAPI : cli
PHP_VERSION : 8.0.0-dev
ZEND_VERSION: 4.0.0-dev
PHP_OS : Linux - Linux student3 4.15.0-72-generic #81~16.04.1-Ubuntu SMP Tue Nov 26 16:34:21
UTC 2019 x86_64
INI actual : /path/to/php-src
More .INIs :
---------------------------------------------------------------------
PHP : /path/to/php-src/sapi/phpdbg/phpdbg
PHP_SAPI : phpdbg
PHP_VERSION : 8.0.0-dev
ZEND_VERSION: 4.0.0-dev
PHP_OS : Linux - Linux student3 4.15.0-72-generic #81~16.04.1-Ubuntu SMP Tue Nov 26 16:34:21
UTC 2019 x86_64
INI actual : /path/to/php-src
More .INIs :
---------------------------------------------------------------------
CWD : /path/to/php-src
Extra dirs :
VALGRIND : Not used
=====================================================================
Running selected tests.
TEST 1/1 [Zend/tests/bug61165.phpt]
========DIFF========
005+ [Sun Jul 26 18:45:57 2020] Script: '/path/to/php-src/Zend/tests/bug61165.php'
006+ /path/to/programming/php-src/Zend/zend_objects.c(178) : Freeing 0x00007f3c2ea039c0 (56 bytes),
script=/path/to/php-src/Zend/tests/bug61165.php
007+ Last leak repeated 3 times
008+ === Total 4 memory leaks detected ===
========DONE========
FAIL Bug #61165 (Segfault - strip_tags()) [Zend/tests/bug61165.phpt]
=====================================================================
Number of tests : 1 1
Tests skipped : 0 ( 0.0%) --------
Tests warned : 0 ( 0.0%) ( 0.0%)
Tests failed : 1 (100.0%) (100.0%)
Tests passed : 0 ( 0.0%) ( 0.0%)
---------------------------------------------------------------------
Time taken : 0 seconds
=====================================================================
=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Bug #61165 (Segfault - strip_tags()) [Zend/tests/bug61165.phpt]
=====================================================================
```
Expected result:
----------------
No memory leaks are reported, or messages should get added to clarify that php deliberately will not
attempt to garbage collect cyclic object cycles if gc is disabled during shutdown.
I don't see any leaks reported in a debug 7.3 build
Actual result:
--------------
Memory leaks are reported with --enable-debug builds during shutdown
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79900&edit=1