Bug #73324 [NEW]: GD excessive memory usage

From: Date: Fri, 14 Oct 2016 18:14:26 +0000
Subject: Bug #73324 [NEW]: GD excessive memory usage
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204783@lists.php.net to get a copy of this message
From: ch at aixit dot com Operating system: * PHP version: 7.0.12 Package: GD related Bug Type: Bug Bug description:GD excessive memory usage Description: ------------ # tested with different linux distros (debian8, centos6.5) # PHP 7.0 (tested with different versions of php 7.0) PHP VERSION: 7.0.12-1+jessie1 IMAGE FILESISE: 205.09K IMAGE FILETYPE: image/jpeg IMAGE DIMENSION: 1240x1754 MEMORY USE (CURRENT/PEAK): 355.20K / 1.42M $img = imagecreatefromjpeg($filename); MEMORY USE (CURRENT/PEAK): 17.01M / 17.01M $img = imagescale($img, 3000); MEMORY USE (CURRENT/PEAK): 65.61M / 82.26M # Same Imagefile with php 5.6 PHP VERSION: 5.6.26-0+deb8u1 MEMORY USE (CURRENT/PEAK): 230.26K / 504.37K $img = imagecreatefromjpeg($filename); MEMORY USE (CURRENT/PEAK): 230.51K / 504.37K $img = imagescale($img, 3000); MEMORY USE (CURRENT/PEAK): 230.51K / 504.37K # configure line './configure' '--prefix=/opt/php-7.0' '--with-config-file-path=/opt/php-7.0/etc' '--with-config-file-scan-dir=/opt/php-7.0/etc/conf-enabled' '--enable-fpm' '--with-fpm-systemd' '--with-imap=/usr' '--with-imap-ssl' '--with-kerberos' '--with-zlib-dir' '--with-freetype-dir' '--enable-mbstring' '--with-libxml-dir=/usr' '--enable-soap' '--with-curl=shared' '--with-mcrypt=shared' '--with-zlib' '--with-gd=shared' '--with-pdo-mysql' '--with-pdo-pgsql' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--with-mysqli' '--enable-sockets' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--with-openssl' '--with-openssl-dir=/usr' '--enable-inline-optimization' '--with-bz2' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-pcntl' '--enable-mbregex' '--with-mhash' '--enable-zip' '--with-pcre-regex' '--enable-ftp' '--with-gettext' '--enable-calendar' '--enable-intl' '--enable-exif' '--enable-bcmath' '--enable-dba' '--enable-shmop' '--enable-wddx' '--with-readline' '--with-ldap=shared' '--with-ldap-sasl' '--with-snmp=shared' '--with-xmlrpc=shared' '--with-mhash=shared' '--with-xsl=shared' '--with-pspell=shared' '--with-gmp=shared' '--with-tidy=shared' # Loaded modules apcu bcmath bz2 calendar Core ctype curl date dba dom exif fileinfo filter ftp gd gettext hash iconv imagick imapintl json ldap libxml mbstring mcrypt mysqli mysqlnd openssl pcntl pcre PDO pdo_mysql pdo_pgsql pdo_sqlite Phar posix readline Reflection session shmop SimpleXML snmp soap sockets SPL sqlite3 ssh2 standard sysvmsg sysvsem sysvshm tokenizer wddx xml xmlreader xmlwriter Zend OPcache zip zlib Zend OPcache Test script: --------------- <?php $filename = "test.jpg"; echo 'Memory usage:' . memory_get_usage() .PHP_EOL; $img = imagecreatefromjpeg($filename); echo 'Memory usage:' . memory_get_usage() .PHP_EOL; -- Edit bug report at https://bugs.php.net/bug.php?id=73324&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73324&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73324&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73324&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=73324&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=73324&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=73324&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=73324&r=needscript Try newer version: https://bugs.php.net/fix.php?id=73324&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=73324&r=support Expected behavior: https://bugs.php.net/fix.php?id=73324&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=73324&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=73324&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=73324&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73324&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=73324&r=dst IIS Stability: https://bugs.php.net/fix.php?id=73324&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=73324&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=73324&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=73324&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=73324&r=mysqlcfg

« previous php.bugs (#204783) next »