#22058 [NEW]: Sending mail with large attachments uses unreasonable amounts of memory

From: Date: Tue, 04 Feb 2003 21:41:57 +0000
Subject: #22058 [NEW]: Sending mail with large attachments uses unreasonable amounts of memory
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-12966@lists.php.net to get a copy of this message
From: brienfwd@bigfoot.com Operating system: linux PHP version: 4.2.0 PHP Bug Type: PEAR related Bug description: Sending mail with 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. -- Edit bug report at http://bugs.php.net/?id=22058&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=22058&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=22058&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=22058&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=22058&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=22058&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=22058&r=support Expected behavior: http://bugs.php.net/fix.php?id=22058&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=22058&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=22058&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=22058&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22058&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=22058&r=dst IIS Stability: http://bugs.php.net/fix.php?id=22058&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=22058&r=gnused

« previous php.pear.dev (#12966) next »