Bug #79519 [Opn]: Memory leak in PHP 7.4

From: Date: Thu, 30 Apr 2020 11:56:18 +0000
Subject: Bug #79519 [Opn]: Memory leak in PHP 7.4
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226852@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79519&edit=1

 ID:                 79519
 Updated by:         cmb@php.net
 Reported by:        kieran at miami-nice dot co dot uk
 Summary:            Memory leak in PHP 7.4
 Status:             Open
 Type:               Bug
 Package:            Performance problem
 Operating System:   Linux
 PHP Version:        7.4.5
 Block user comment: N
 Private report:     N

 New Comment:

Please tests with PHP 7.4.6RC1 (has just been released).


Previous Comments:
------------------------------------------------------------------------
[2020-04-30 11:37:33] maggus dot staab+php at gmail dot com

Could it be related to the recently fixed leak 

https://github.com/php/php-src/commit/3151676f520555bfadb39ea76779e93552d13fc1

------------------------------------------------------------------------
[2020-04-28 17:33:12] kieran at miami-nice dot co dot uk

It's something to do with the use of require

Another example, different code, but same principle. 

https://github.com/bytestream/php74-memory-leak/tree/factories

$ php7.2 vendor/bin/phpunit --repeat 100
Time: 1.75 minutes, Memory: 322.00 MB

$ php7.3 vendor/bin/phpunit --repeat 100
Time: 1.02 minutes, Memory: 310.50 MB

$ php7.4 vendor/bin/phpunit --repeat 100
Time: 2.24 minutes, Memory: 1.32 GB

------------------------------------------------------------------------
[2020-04-28 16:27:56] kieran at miami-nice dot co dot uk

Adding more routes to the test case seems to show some interesting results.

https://github.com/bytestream/php74-memory-leak/tree/routes

$ php7.2 vendor/bin/phpunit --repeat 1000
Time: 1.09 minutes, Memory: 144.00 MB

$ php7.3 vendor/bin/phpunit --repeat 1000
Time: 17.47 seconds, Memory: 138.00 MB

$ php7.4 vendor/bin/phpunit --repeat 1000
Time: 58.73 seconds, Memory: 510.00 MB

------------------------------------------------------------------------
[2020-04-28 14:55:00] kieran at miami-nice dot co dot uk

> maybe Blackfire already collects them and I can't find it

Sent a message to Blackfire to see if they can provide any insight.

> The PHP 7.3 memory profile states that the peak memory would be
> 761 MB, but for the Text::getConsecutiveWords the allocated memory
> is reported as 4060 MB.  That appears to be contradictory.

I think this may be something else.

https://github.com/bytestream/php74-memory-leak

$ php7.3 vendor/bin/phpunit --repeat 100
Time: 3.78 seconds, Memory: 396.00 MB

$ php7.4 vendor/bin/phpunit --repeat 100
Time: 11.56 seconds, Memory: 734.00 MB

with gc_collect_cycles in tearDown - ref; https://github.com/fzaninotto/Faker/pull/1730

$ php7.3 vendor/bin/phpunit --repeat 100
Time: 4.71 seconds, Memory: 32.00 MB

$ php7.4 vendor/bin/phpunit --repeat 100
Time: 13.54 seconds, Memory: 34.00 MB

If I add gc_collect_cycles to the full app, PHP 7.4 memory usage remains unchanged at 3.89GB

------------------------------------------------------------------------
[2020-04-27 15:35:27] cmb@php.net

The PHP 7.3 memory profile states that the peak memory would be
761 MB, but for the Text::getConsecutiveWords the allocated memory
is reported as 4060 MB.  That appears to be contradictory.

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=79519


--
Edit this bug report at https://bugs.php.net/bug.php?id=79519&edit=1


Thread (25 messages)

« previous php.bugs (#226852) next »