php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25871 imagecreatetruecolor uses memory excessively
Submitted: 2003-10-14 15:27 UTC Modified: 2003-10-14 19:49 UTC
From: bb at ii dot nl Assigned:
Status: Not a bug Package: GD related
PHP Version: 4.3.3 OS: RedHat Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
48 + 39 = ?
Subscribe to this entry?

 
 [2003-10-14 15:27 UTC] bb at ii dot nl
Description:
------------
ImageCreateTrueColor crashes PHP if I allocate an image over ~4000000 pixels in size.

I use PHP 4.3.3 with GD version: bundled (2.0.15 compatible)

Memory_limit is set to 26214400

Reproduce code:
---------------
$im = imagecreatetruecolor(1500,4000);


Actual result:
--------------
PHP crashes

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-10-14 17:33 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

PHP crashes (probably just exists) due to reaching the memory limit and being unable to allocate additional memory.
 [2003-10-14 19:41 UTC] bb at ii dot nl
I have read the documentation, but I could not find any reference to a maximum image size supported. The problem does indeed seem to be memory running out. When I increased the memory available to PHP to 50mb, the large images no longer terminated the script.

I've changed the bug report to a 'performance problem', as I believe imagecreatetruecolor is somewhat wasteful with resources. The script terminates with a 1310x4000 image, about 5.3mpix in size, with a 25mb memory limit. Apparently imagecreatetruecolor takes almost twice the memory it should.

Sorry about not investigating the memory thing sooner, before submitting. I should've thought of that myself.
 [2003-10-14 19:49 UTC] sniper@php.net
That's GD problem, not PHP. Report it to the GD author.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 20:01:29 2024 UTC