|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-09-22 18:21 UTC] nikic@php.net
-Status: Open
+Status: Duplicate
[2020-09-22 18:21 UTC] nikic@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Fri Jan 02 04:00:01 2026 UTC |
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