ID:               47000
 Comment by:       alan at binarystars dot com
 Reported By:      alan at binarystars dot com
 Status:           Feedback
 Bug Type:         IMAP related
 Operating System: 2.6.25-14.fc9.i686
 PHP Version:      5.2.8
 New Comment:

iliaa at php.net, 
Give me a moment to update. Thanks.


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

[2009-01-05 16:01:47] il...@php.net

Can you run it via valgrind rather then php's memory checker? I suspect

the issue is just some temp vars that will be cleaned up by garbage 
collection.

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

[2009-01-04 21:31:09] alan at binarystars dot com

Description:
------------
# Problem:
imap_body() and imap_savebody() memory leak. During the following 
test of 26 email messages totaling a sum of 244.05Mb it seems you 
need TWICE the amount of memory in order to receive the message body 
via imap_body(). When using the imap_savebody() func it seems you 
need approximately the same amount of memory as the email message 
itself. The problem in particular is repeatable in any size email 
message... even when you unset the variables/objects returned by the 
func. In other words, you want to receive a message body of 5Mb using 
imap_body() func; you'll need 10Mb of available free RAM just to 
store the message body to a variable. Now, say you receive 10 
messages each at 5Mb, and unset all the variables. That would mean 
you'll need 100Mb of free memory to read all ten messages. See the 
reproduced code and the results for more information.

# Question:
Is there a way to flush the memory without actually exiting out of 
the script?

Reproduce code:
---------------
Colorized version:
http://home.binarystars.com/~alan/imap_bug/test.html (30k)

Text version:
http://home.binarystars.com/~alan/imap_bug/test.txt (5.3k)

Result of method 1 via imap_body():
http://home.binarystars.com/~alan/imap_bug/method1_results.txt (3.6k)

Result of method 2 via imap_savebody():
http://home.binarystars.com/~alan/imap_bug/method2_results.txt


Expected result:
----------------
When I run the script I expect it to use less (RSS) resident memory.

Actual result:
--------------
Instead of freeing up memory the script takes up more than Oracle 
running five hundred databases.


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


-- 
Edit this bug report at http://bugs.php.net/?id=47000&edit=1

Reply via email to