|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-07-13 13:14 UTC] cmb@php.net
Description: ------------ Apparently, imagescale(..., IMG_BICUBIC) leaks memory. Test script: --------------- <?php $im = imagecreatetruecolor(256, 256); imagescale($im, 32, 32, IMG_BICUBIC); imagedestroy($im); ?> Expected result: ---------------- Actual result: -------------- [Mon Jul 13 15:11:26 2015] Script: '/home/cmb/test.php' /home/cmb/php-src/ext/gd/libgd/gd.c(202) : Freeing 0x7FC6B1657680 (32 bytes), s cript=/home/cmb/test.php /home/cmb/php-src/Zend/zend_alloc.c(2266) : Actual location (location was relaye d) Last leak repeated 255 times [Mon Jul 13 15:11:26 2015] Script: '/home/cmb/test.php' /home/cmb/php-src/ext/gd/libgd/gd.c(193) : Freeing 0x7FC6B165AE00 (2048 bytes), script=/home/cmb/test.php [Mon Jul 13 15:11:26 2015] Script: '/home/cmb/test.php' /home/cmb/php-src/ext/gd/libgd/gd.c(194) : Freeing 0x7FC6B165B800 (2048 bytes), script=/home/cmb/test.php [Mon Jul 13 15:11:26 2015] Script: '/home/cmb/test.php' /home/cmb/php-src/ext/gd/libgd/gd.c(201) : Freeing 0x7FC6B1680000 (128 bytes), script=/home/cmb/test.php /home/cmb/php-src/Zend/zend_alloc.c(2266) : Actual location (location was relaye d) Last leak repeated 255 times === Total 514 memory leaks detected === PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 09:00:01 2025 UTC |
Well, actually the test script should have been: <?php $im = imagecreatetruecolor(256, 256); imagedestroy(imagescale($im, 32, 32, IMG_BICUBIC)); imagedestroy($im); ?> but that doesn't change the result. The problem is that a temporary image is freed with gdFree() instead of gdImageDestroy(). I've already reported that upstream[1]. [1] <https://github.com/libgd/libgd/issues/173>