ID: 20470 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Closed +Status: Open Bug Type: GD related Operating System: Linux 2.2.19 PHP Version: 4.3.0RC1 New Comment:
Even with Derick's patch we still have some memory lacks so we open it back. Previous Comments: ------------------------------------------------------------------------ [2002-11-17 20:44:58] [EMAIL PROTECTED] This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. ------------------------------------------------------------------------ [2002-11-17 20:20:19] [EMAIL PROTECTED] I have a PHP script for outputting a PNG image. It uses the following functions: ImageCreateFromPNG ImageColorClosest ImageTTFText ImageTTFBBox ImageLine ImagePNG ImageDestroy This worked correctly with PHP 4.0.6 , GD 1.8.4, FreeType 1.3.1. (At the time I first installed PHP4, these were the latest versions of GD and FreeType that behaved properly). When I upgraded to PHP 4.3.0RC1, with builtin GD, executing the same script produced memory leak errors in the Apache log: /usr/local/src/php-4.3.0RC1/ext/gd/libgd/gdhelpers.c(89) : Freeing 0x082B9CE4 (8 bytes), script=/u/www/paygate/cheque-image.php Last leak repeated 270 times /usr/local/src/php-4.3.0RC1/ext/gd/libgd/gdhelpers.c(89) : Freeing 0x082BDDA4 (8 bytes), script=/u/www/paygate/cheque-image.php [Mon Nov 18 12:48:04 2002] [notice] child pid 10950 exit signal Segmentation fault (11) /usr/local/src/php-4.3.0RC1/ext/gd/libgd/gdhelpers.c(89) : Freeing 0x082B8B84 (8 bytes), script=/u/www/paygate/cheque-image.php Last leak repeated 264 times Sometimes the image would still display correctly anyway, and sometimes there would be no output (presumably corresponding to those times that Apache segfaulted, although I did not check this explicitly). I found that I could correct the problem by not using the builtin GD. This required two steps: -- modify my ./configure command to use --with-gd=/path/to/gd instead of --with-gd -- modify php_config.h to say HAVE_GD_GD2 0 (in 2 places), ./configure did not pick up automatically that my installed GD was 1.x After rebuilding with these GD settings the image was generated correctly with no memory leaks and no segfaults. I guess therefore that there is something wrong with the builtin GD code. Here is my ./configure line (that generates the buggy version): ./configure --with-mcrypt --with-mhash --with-mysql=../../mysql --with-gd --enable-versioning --with-ttf --enable-shared --enable-freetype-4bit-antialias-hack --with-informix --with-bz2 --with-gmp --with-zlib --enable-sockets --with-config-dir=/usr/local/etc --enable-debug --with-png-dir=/usr/local --with-jpeg-dir=/usr/local --without-pear --with-apxs When using "--with-gd", phpinfo() displays "GD Version" as "bundled (2.0 compatible)" and "GIF Support" as "enabled". When using "--with-gd=/path/to/gd", phpinfo() displays "GD Version" as "1.6.2 or higher" and does not display the "GIF Support" line. All other GD fields stay the same (ie. "enabled", except for "FreeType Linkage" which is "with TTF library"). Thanks, Matt. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20470&edit=1