On Oct 21, 2005, at 5:32 PM, Christopher A. Watford wrote:

1 copy for the function call
1 copy for the return from str_replace

But the copy for the function call os str_replace() should be destroyed when the function returns, and the return value should *replace* the already existing copy in $message.

I agree that there should be some more memory used in between memory checks, but the *net* change should be zero or less, depending on the existence of "\r"'s.

--lonnie

On 10/21/05, Lonnie Olson <[EMAIL PROTECTED]> wrote:

Does anyone have a clue why this particular statement would create 2
more copies of the message body in memory?

---------------
function iil_C_Append(&$conn, $folder, $message){
        if (!$folder) return false;
        $fp = $conn->fp;
dbg_memory();
        $message = str_replace("\r", "", $message);
dbg_memory();
--------------
results with a 2.5M message
Oct 21 15:44:39 /home/f/fungus/public_html/mail/program/lib/imap.inc
[1886]: E_USER_NOTICE: Memory used: 12796160
Oct 21 15:44:39 /home/f/fungus/public_html/mail/program/lib/imap.inc
[1888]: E_USER_NOTICE: Memory used: 18044080

This is the block in the Iloha library that is creating the two extra
copies in memory.  Perhaps it is a PHP bug?

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to