Bug #79900 [NEW]: Memory leaks reported in zend_objects_new with zend.enable_gc=0
| From: | tandre@php.net | Date: | Sun, 26 Jul 2020 22:56:25 +0000 |
| Subject: | Bug #79900 [NEW]: Memory leaks reported in zend_objects_new with zend.enable_gc=0 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-228233@lists.php.net to get a copy of this message | ||
From: tandre
Operating system:
PHP version: 8.0Git-2020-07-26 (Git)
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Memory leaks reported in zend_objects_new with zend.enable_gc=0
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 bug report at https://bugs.php.net/bug.php?id=79900&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79900&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79900&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79900&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79900&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79900&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79900&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79900&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79900&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79900&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79900&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79900&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79900&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79900&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79900&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79900&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79900&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79900&r=mysqlcfg