Bug #71093 [NEW]: GD: Very high memory consumption with bundled library 2.1.0
| From: | jeep dot gaudreau at gmail dot com | Date: | Fri, 11 Dec 2015 14:38:23 +0000 |
| Subject: | Bug #71093 [NEW]: GD: Very high memory consumption with bundled library 2.1.0 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-197792@lists.php.net to get a copy of this message | ||
From: jeep dot gaudreau at gmail dot com
Operating system: Fedora 23
PHP version: 5.6.16
Package: GD related
Bug Type: Bug
Bug description:GD: Very high memory consumption with bundled library 2.1.0
Description:
------------
I found out that the GD library bundled with PHP 5.6.16 (version 2.1.0)
is using a lot of memory when calling functions "imagecreatefromjpeg" or
"imagecreatefromstring" on JPEG files.
A JPEG file of about 4MB can generate up to 300MB of memory while it
take not more than a few KB when using the OS package of GD version
2.1.1.
I can also reproduce the bug on RHEL6.5
Maybe the solution would only be to upgrade the bundled PHP GD library
to 2.1.1.
Here's the GD info when memory consumption is very high :
GD Support enabled
GD Version bundled (2.1.0 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.6.0
T1Lib Support enabled
GIF Read Support enabled
GIF Create Support enabled
JPEG Support enabled
libJPEG Version 6b
PNG Support enabled
libPNG Version 1.6.19
WBMP Support enabled
XPM Support enabled
libXpm Version 30411
XBM Support enabled
WebP Support enabled
GD Support enabled
Here's the GD info when memory consumption is low :
GD headers Version 2.1.1
GD library Version 2.1.1
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.6.0
T1Lib Support enabled
GIF Read Support enabled
GIF Create Support enabled
JPEG Support enabled
libJPEG Version 6b
PNG Support enabled
libPNG Version 1.6.19
WBMP Support enabled
XPM Support enabled
libXpm Version 30411
XBM Support enabled
WebP Support enabled
Test script:
---------------
Very easy to reproduce:
* Create the following PHP script:
<?php
$path = 'img.jpg';
//$image = imagecreatefromjpeg($path);
$image = imagecreatefromstring(file_get_contents($path));
var_dump(memory_get_usage());
* Execute with the following JPEG image:
https://drive.google.com/open?id=0B0H8CbGn160eMHg3cGZrSmtzRTA
You should have very high memory usage with bundled library 2.1.0
You should have very low memory usage with OS package GD version 2.1.1
--
Edit bug report at https://bugs.php.net/bug.php?id=71093&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71093&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71093&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71093&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71093&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71093&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71093&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71093&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71093&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71093&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71093&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71093&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71093&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71093&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71093&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71093&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71093&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71093&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71093&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71093&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71093&r=mysqlcfg