php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80135 Memory leak - some data structure is not shrunk
Submitted: 2020-09-22 17:28 UTC Modified: 2020-09-22 18:21 UTC
From: mvorisek at mvorisek dot cz Assigned:
Status: Duplicate Package: Scripting Engine problem
PHP Version: 7.4.10 OS: any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
6 + 42 = ?
Subscribe to this entry?

 
 [2020-09-22 17:28 UTC] mvorisek at mvorisek dot cz
Description:
------------
see test script, there is some zval/GC data structure, that is currently not shrunk

this is an issue for workers that normally process small and large requests occasionally, as once the data structure inside php engine is enlarged, it never goes back and memory per worker/process stays allocated

Test script:
---------------
function createGraph($c) {
    $objs = [];
    for ($i = 0; $i < $c; $i++) {
        $obj = new \stdClass();
        $objs[] = $obj;
        $obj->x = $objs[mt_rand(0, count($objs) - 1)];
    }
}

for ($i = 0; $i < 5; $i++) {
    createGraph(2 * 1000 * 1000);
    
    gc_collect_cycles();
    echo round(memory_get_usage() / (1024 * 1024), 3) . " MiB\n";
}

Expected result:
----------------
memory usage stays below 1 MiB

Actual result:
--------------
16.361 MiB
16.361 MiB
16.361 MiB
16.361 MiB
16.361 MiB

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-09-22 18:21 UTC] nikic@php.net
-Status: Open +Status: Duplicate
 [2020-09-22 18:21 UTC] nikic@php.net
Duplicate of bug #33487.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 26 06:01:31 2024 UTC