FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=17887&edit=1

ID: 17887
Updated by: jon@php.net
Reported By: haw dot loeung at tpg dot com dot au
Summary: Patch to reduce peak memory usage in the data()
function
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: Net_SMTP
Operating System: Linux
Package Version: 1.4.2
PHP Version: 5.3.3
-Assigned To:
+Assigned To: jon
Roadmap Versions:
New Comment:

-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: jon
This bug has been fixed in SVN.

If this was a documentation problem, the fix will appear on pear.php.net
by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should
be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.

Thanks for the suggestion!


Previous Comments:
------------------------------------------------------------------------

[2010-09-23 02:49:49] hloeung

Added #patch
bug:17887;patch:Net_SMTP.php-reduce-peak-memory-usage.pa;revision:1285210189;.

------------------------------------------------------------------------

[2010-09-23 02:48:21] hloeung

Description:
------------
This patch reduces the peak memory usage by breaking up large
data() into smaller blocks and running quotedata() on these
smaller blocks.

Test script:
---------------
<?php
require 'Net/SMTP.php';

$fh = fopen('20mbody.txt', 'r');
$body = fread($fh, filesize('20mbody.txt'));
fclose($fh);

if (! ($smtp = new Net_SMTP('mail.tpg.com.au'))) {
die("Unable to instantiate Net_SMTP object\n");
}
$smtp->connect();
$smtp->mailFrom('hawl@tpg.com.au');
$smtp->rcptTo('hawl@tpg.com.au');
echo 'file=' . substr(__FILE__, strrpos(__FILE__, '/') + 1) . '; line='
. __LINE__ . '; mem_used=' . memory_get_usage(0) . ' [' .
memory_get_usage(1) . ']; peak_mem=' . memory_get_peak_usage(0) . ' [' .
memory_get_peak_usage(1) . "]\n";
$smtp->data($body, 'Test message');
echo 'file=' . substr(__FILE__, strrpos(__FILE__, '/') + 1) . '; line='
. __LINE__ . '; mem_used=' . memory_get_usage(0) . ' [' .
memory_get_usage(1) . ']; peak_mem=' . memory_get_peak_usage(0) . ' [' .
memory_get_peak_usage(1) . "]\n";
$smtp->disconnect();
?>

Expected result:
----------------
file=test.php; line=15; mem_used=23665104 [23855104];
peak_mem=23675304 [23855104]
file=test.php; line=17; mem_used=23665152 [23855104];
peak_mem=26745888 [27000832]

Actual result:
--------------
file=test.php; line=14; mem_used=23661688 [23855104];
peak_mem=23671888 [23855104]
file=test.php; line=16; mem_used=23661736 [23855104];
peak_mem=158207704 [159121408]

------------------------------------------------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedSep 28, '10 at 5:02a
activeSep 28, '10 at 5:02a
posts1
users1
websitepear.php.net

1 user in discussion

Jon: 1 post

People

Translate

site design / logo © 2021 Grokbase