[bugs] [Bug 1162] New - Sending of large attachments uses unreasonable amounts of memory

bugs at bugs.horde.org bugs at bugs.horde.org
Thu Jan 30 19:08:23 PST 2003


http://bugs.horde.org/show_bug.cgi?id=1162

*** shadow/1162	Thu Jan 30 19:08:23 2003
--- shadow/1162.tmp.24817	Thu Jan 30 19:08:23 2003
***************
*** 0 ****
--- 1,39 ----
+ Bug#: 1162
+ Product: Horde
+ Version: other
+ Platform: PHP Code
+ OS/Version: Linux
+ Status: NEW   
+ Resolution: 
+ Severity: normal
+ Priority: P2
+ Component: IMP
+ Area: BUILD
+ AssignedTo: chuck at horde.org                            
+ ReportedBy: brienfwd at bigfoot.com               
+ URL: 
+ Summary: Sending of large attachments uses unreasonable amounts of memory
+ 
+ I've just tracked down a long standing problem I've had with the IMP webmail 
+ problem and large attachments.  I've configure IMP 3.1/PEAR 1.0.1 to use SMTP 
+ to talk to a local mail server.  Sending a message with a 13MB attachment (19 
+ MB encoded) causes the memory usage to shoot up to 122MB. This seems to be due 
+ to the handling of the message body with regards to string copies and regular 
+ expression replacements.
+ 
+ This effectively limits the size of attachements that are useable within imp 
+ not to mention puts a pretty big strain on my server.
+ 
+ 
+ In particular, my installation seems to crap out consistently on the line 
+ inside the data() function: 
+ 
+ $data = preg_replace("/([^\r]{1})\n/", "\\1\r\n", $data);
+ 
+ 
+ There are a couple of ways to solve this problem.  The best solution, which is 
+ probably the hardest, is to refactor the SMTP api to be more aware of file 
+ attachments and avoid doing the read-file/encode/write-to-network on the entire 
+ file.  If the SMTP layer was aware of file attachments, it could do the read-
+ file/encode/write-to-network on reasonably sized blocks.
+ 


More information about the bugs mailing list