Bug #80135 [NEW]: Memory leak - some data structure is not shrunk

From: Date: Tue, 22 Sep 2020 17:28:10 +0000
Subject: Bug #80135 [NEW]: Memory leak - some data structure is not shrunk
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-229148@lists.php.net to get a copy of this message
From: mvorisek at mvorisek dot cz Operating system: any PHP version: 7.4.10 Package: Scripting Engine problem Bug Type: Bug Bug description:Memory leak - some data structure is not shrunk 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 -- Edit bug report at https://bugs.php.net/bug.php?id=80135&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=80135&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=80135&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=80135&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=80135&r=needscript Try newer version: https://bugs.php.net/fix.php?id=80135&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=80135&r=support Expected behavior: https://bugs.php.net/fix.php?id=80135&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=80135&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=80135&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=80135&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=80135&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=80135&r=dst IIS Stability: https://bugs.php.net/fix.php?id=80135&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=80135&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=80135&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=80135&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=80135&r=mysqlcfg

« previous php.bugs (#229148) next »