php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72024 microtime() leaks memory
Submitted: 2016-04-14 14:34 UTC Modified: 2016-07-08 04:58 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: maroszek at gmx dot net Assigned: ab
Status: Closed Package: Date/time related
PHP Version: 5.6.20 OS: Windows 10 x64
Private report: No CVE-ID:
 [2016-04-14 14:34 UTC] maroszek at gmx dot net
Description:
------------
Just run the script and watch the memory consumption rise. It goes way beyond the specified memory limit, therefore i suspect a simple memory leak.

Not reproducable on 7.0.x. 
Not reproducable on 5.4.x.

Bug must have been introduced with PHP 5.5. This is the first affected version.

Test script:
---------------
<?

while(true) { microtime(); }

Expected result:
----------------
Steady memory consumption.

Actual result:
--------------
Right before max_execution_time occurs, php.exe is consuming a few hundred megabytes of RAM.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-07-07 12:29 UTC] maroszek at gmx dot net
I added a fix and PR here: https://github.com/php/php-src/pull/1989

It would be awesome if you could merge this.

PHP7 is not affected. It just NOPs this function.
 [2016-07-08 04:58 UTC] pajoye@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: ab
 [2016-07-08 09:50 UTC] maroszek at gmx dot net
I accidentally added another commit to the PR. Can you merge both commits or shall it just cancel the PR and create a new one?

The other commit is just a backport from an already accepted one: 
https://bugs.php.net/bug.php?id=71144

Sorry for the mess.
 [2016-07-08 13:07 UTC] jpauli@php.net
Automatic comment on behalf of maroszek@gmx.net
Revision: http://git.php.net/?p=php-src.git;a=commit;h=0be13d2dc24f2802a231f92912ba5d089dad6676
Log: fix bug #72024 (microtime() leaks memory)
 [2016-07-08 13:07 UTC] jpauli@php.net
-Status: Assigned +Status: Closed
 [2016-07-08 13:07 UTC] jpauli@php.net
Automatic comment on behalf of maroszek@gmx.net
Revision: http://git.php.net/?p=php-src.git;a=commit;h=0be13d2dc24f2802a231f92912ba5d089dad6676
Log: fix bug #72024 (microtime() leaks memory)
 [2016-07-08 13:07 UTC] jpauli@php.net
Automatic comment on behalf of maroszek@gmx.net
Revision: http://git.php.net/?p=php-src.git;a=commit;h=0be13d2dc24f2802a231f92912ba5d089dad6676
Log: fix bug #72024 (microtime() leaks memory)
 [2016-07-08 13:13 UTC] maroszek at gmx dot net
Awesome. Thanks!
 [2016-10-17 10:11 UTC] bwoebi@php.net
Automatic comment on behalf of maroszek@gmx.net
Revision: http://git.php.net/?p=php-src.git;a=commit;h=0be13d2dc24f2802a231f92912ba5d089dad6676
Log: fix bug #72024 (microtime() leaks memory)
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Aug 29 15:01:52 2017 UTC