6.0.0-beta1
9/24/25

[#5315] Horde_Image_gd code hits memory limit on large images
Summary Horde_Image_gd code hits memory limit on large images
Queue Horde Framework Packages
Queue Version HEAD
Type Bug
State Resolved
Priority 1. Low
Owners
Requester vilius (at) lnk (dot) lt
Created 04/26/2007 (6726 days ago)
Due
Updated 05/04/2007 (6718 days ago)
Assigned 05/03/2007 (6719 days ago)
Resolved 05/04/2007 (6718 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
05/04/2007 05:29:21 PM Michael Slusarz Comment #8
State ⇒ Resolved
Reply to this comment
Added output of an error image on Horde_Image load fail.
05/03/2007 09:41:49 PM Jan Schneider Comment #7 Reply to this comment
There were two places that I changed to not load the image data 
anymore, maybe only one is required. I guess it's only important to 
not load the data twice in the same request. The one left untouched is 
from the request that actual displays the thumbnail. The other two 
should theoretically be from the request that displays the message.

Alternatively we could display a placeholder image in case of an 
error, like the question mark image in Ansel.
05/03/2007 08:17:37 PM Michael Slusarz Comment #6
State ⇒ Feedback
Reply to this comment
This could at least make it worse. I tweaked the code so that at
least the image data is not loaded in
IMP_MIME_Viewer_images::_getHordeImageObj() if not necessary. See if
this helps any.
Unfortunately this change will now potentially cause us to display an 
invalid thumbnail image - or at least we will inform the user we are 
going to display a thumbnail and then none will appear.  That's why we 
do the check twice - the first time is to check if we can even attempt 
to load the thumbnail.



For now, I have changed the code to return an empty string for the 
image data but we may want to rethink the original patch.
05/02/2007 09:02:28 AM Jan Schneider State ⇒ Resolved
 
05/02/2007 08:53:26 AM vilius (at) lnk (dot) lt Comment #5 Reply to this comment
P.S. I also noticed that _getHordeImageObj() is called twice for
every image attachment. Could this also be the problem?
This could at least make it worse. I tweaked the code so that at
least the image data is not loaded in
IMP_MIME_Viewer_images::_getHordeImageObj() if not necessary. See if
this helps any.
This works better. PHP spews message about exhausted memory into log, 
but a page with an email message is at least displayed in the browser. 
Thanks!
05/02/2007 08:25:29 AM Jan Schneider Comment #4 Reply to this comment
However when I tried to open the same image in IrfanView it consumed
~104Mb. Does this mean that most email programs (including GD
library) just loads raw code into memory without any optimizations? I
Not only email programs I guess. Image viewers are usually optimized 
to display any kind of image, of any size.
wonder what could be done in such cases. Try to hack GD library to
limit picture size?
I don't know if this is possible. Ask Pierre who is maintaining the GD 
library for the PHP project now.
P.S. I also noticed that _getHordeImageObj() is called twice for
every image attachment. Could this also be the problem?
This could at least make it worse. I tweaked the code so that at least 
the image data is not loaded in 
IMP_MIME_Viewer_images::_getHordeImageObj() if not necessary. See if 
this helps any.
05/02/2007 08:10:07 AM vilius (at) lnk (dot) lt Comment #3 Reply to this comment
Ghmm, I tried to load this message into Outlook Express and into 
Thunderbird and seems like you are right. Both clients started to 
consume >300Mb of virtual memory.



However when I tried to open the same image in IrfanView it consumed 
~104Mb. Does this mean that most email programs (including GD library) 
just loads raw code into memory without any optimizations? I wonder 
what could be done in such cases. Try to hack GD library to limit 
picture size?



P.S. I also noticed that _getHordeImageObj() is called twice for every 
image attachment. Could this also be the problem?
05/01/2007 10:15:23 PM Jan Schneider Comment #2
Taken from Michael Slusarz
State ⇒ Feedback
Reply to this comment
The filesize doesn't matter anyway. A 10,000 x 10,000 pixel image of 
any format and 24 bit color depth consumes 300,000,000 bytes if I did 
my math correctly. I bet such a size could easily hit the limit by 
only loading the image into memory as soon you add the overhead of a 
real application or do any operation with that data.

Try to load such an image into a desktop application.
04/30/2007 08:38:05 PM Chuck Hagenbuch Assigned to Michael Slusarz
State ⇒ Assigned
 
04/26/2007 03:37:12 PM vilius (at) lnk (dot) lt Comment #1
Priority ⇒ 1. Low
State ⇒ Unconfirmed
New Attachment: 55364 Download
Queue ⇒ Horde Framework Packages
Summary ⇒ Horde_Image_gd code hits memory limit on large images
Type ⇒ Bug
Reply to this comment
I noticed that the new image thumbnail code in IMP hits memory limit 
with large images. Large not in filesize but in dimensions. Even if 
memory limit is set 512mb (what is very big). Old code hasn't had such 
problem. Attached is sample message with 10000x10000 pixels JPG (1.4mb).

Saved Queries