Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.2.7

Bug #794 Out of memory
Submitted: 2004-02-19 07:17 UTC
From: thoa0025 at mail dot usyd dot edu dot au Assigned: quipo
Status: Closed Package: Mail_Queue
PHP Version: 4.3.3 OS: linux
Roadmaps: (Not assigned)    

 [2004-02-19 07:17 UTC] thoa0025 at mail dot usyd dot edu dot au
Description: ------------ Mail_Queue runs out of memory when i send HTML based emails as it stores the headers and bodies which are large strings in memory. This occurs depending on the email but usually when i send 25-50 emails which are all HTML based. My php installation allows only 24mb of memory in it's execution and the array holding all the Mail_Queue_Body gets larger than it can be. To fix this I modified the system NOT to store the header and body strings in memory, and retreive and return them from the database, when the getHeaders() or getBody() method is called (which in my application is only once in it's lifetime).


 [2004-02-21 11:06 UTC] thomas-pear at mysnip dot de
So you retrieve each message alone on sending it? are these html messages that large? maybe its usefull to have a switch for that behaviour.
 [2004-02-21 13:06 UTC] chief at php dot net
It should be possibility to fetch() each mail separately instead of reading all to the queue at once. Thanx for the info I will try do this without breaking BC.
 [2004-02-29 14:48 UTC] quipo
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on In case this was a website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.
 [2004-02-29 23:43 UTC] thoa0025 at mail dot usyd dot edu dot au
No, only the meta information for the mail_queue record is retreived (everything which is currently retreived minus the body and the headers). When the header or the body is needed it is retreived out of the database. My hack, has really coupled the database into the object which is probably what you do not want. The emails are not huge. A html email template is used with about 500 characters of text. So storing 25-50 emails in memory kills the application.
 [2004-03-01 08:53 UTC] quipo
Have you tried with the new setBufferSize() method? It allows you to choose how many emails can stay in memory at any given time. See the Mail_Queue_Container_mdb.php source for an usage example