Public bug reported: I noticed that php processes do not free memory after killing scripts that are running more than allowed by max_execution_time directive.
My setup is lighttpd with php configured as fcgi. Sample script (requires php-imagick) that can easily hit default 30 seconds time limit and uses a lot of memory so leaks are easy to notice: <?php define('__BASE__', 'images'); $photos = []; if ($album_root = opendir(__BASE__)) { while (false !== ($entry = readdir($album_root))) { if (preg_match('/\.(jpe?g|gif|png)$/i', $entry)) { $photos[] = $entry; } } closedir($album_root); sort($photos); foreach($photos as $photo) { $thumb = 'thumbs/'.$photo; if (!file_exists($thumb)) { $image = new \Imagick(realpath(__BASE__.'/'.$photo)); $image->thumbnailImage(64, 48, true, false); $image->writeImage($thumb); $image->clear; $image = null; } } } ?> Just put many big JPGs to images directory. ProblemType: Bug DistroRelease: Ubuntu 16.04 Package: php7.0-cgi 7.0.15-0ubuntu0.16.04.4 ProcVersionSignature: Ubuntu 4.8.0-45.48~16.04.1-generic 4.8.17 Uname: Linux 4.8.0-45-generic x86_64 ApportVersion: 2.20.1-0ubuntu2.5 Architecture: amd64 Date: Thu Mar 30 14:37:16 2017 InstallationDate: Installed on 2011-04-14 (2177 days ago) InstallationMedia: Ubuntu-Server 10.04.2 LTS "Lucid Lynx" - Release amd64 (20110211.1) SourcePackage: php7.0 UpgradeStatus: Upgraded to xenial on 2016-07-30 (242 days ago) ** Affects: php7.0 (Ubuntu) Importance: Undecided Status: New ** Tags: amd64 apport-bug xenial -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1677578 Title: php-fcgi: max_execution_time causes memory leaks To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/php7.0/+bug/1677578/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs