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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mvorisek at mvorisek dot cz
New email:
PHP Version: OS:

 

 [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-2021 The PHP Group
All rights reserved.
Last updated: Wed Oct 20 12:03:34 2021 UTC