« Return to Thread: Download Attachment Out of Memory Error

Re: Download Attachment Out of Memory Error

by Jon Angliss :: Rate this Message:

Reply to Author | View in Thread

On Wed, 03 Jun 2009 11:34:22 +0100, Daniel Watts <d@...>
wrote:

>Trying to download a 22MB rar file from sqirrelmail results in:
>
>  Fatal error: Allowed memory size of 100663296 bytes exhausted (tried
>to allocate 71 bytes) in
>/var/www/localhost/webmail/functions/imap_general.php on line 491
>
>
>We tried at 25MB xls file also - had to increase memory allowance to
>around 200MB to get it to download.
>
>Any ideas why so much memory for a relatively small file?

Oi, why do people insist on emailing such big files :)

bas64 encoding adds about a 3rd on top of the actual files size in
encoding.  So your 25MB file is now about 32MB in raw encoded data.

Now, the cause of the problem is because of how we are fetching the
data from the IMAP server.  We're telling the IMAP server to give us
the object data back to us in a single call, not much we can do about
that, which means the IMAP server is dumping back to us the ~32MB of
encoded data, which we process in chunks and decode.  The problem is,
we're dumping it into a variable to post back to the browser after
it's done, which is where the memory issue comes up.  

I'm skimming over the code to see if we can stream the decoded data
straight back to the browser instead of dumping it to a variable
first.

--
Jonathan Angliss
<jon@...>


------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
-----
squirrelmail-devel mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: squirrelmail-devel@...
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel

 « Return to Thread: Download Attachment Out of Memory Error