PHP Classes

Allowed memory size of xxx bytes exhausted

Recommend this page to a friend!

      MIME E-mail message sending  >  All threads  >  Allowed memory size of xxx bytes...  >  (Un) Subscribe thread alerts  
Subject:Allowed memory size of xxx bytes...
Summary:memory optimisation?
Messages:4
Author:Arek Koc
Date:2013-03-06 12:09:09
Update:2013-03-07 11:45:05
 

  1. Allowed memory size of xxx bytes...   Reply   Report abuse  
Picture of Arek Koc Arek Koc - 2013-03-06 12:09:09
I'm sending e-mails with images and text to my users, every time other images. I'm doing it by loop every time creating object, images etc

while(..)
{
$message_object = new email_message_class;

# adding something about 10 images
$message_object->CreateFilePart($obraz,$pipd);
#... etc

$message_object->Send();
}

But after sending something about 100, sometimes 150 mails I have memory trouble

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted

Every message have something about 30KB. I don't cache images, CreateFileImage parameter table looks like

$obraz['FileName']="/home/www/image.gif";
$obraz['Content-Type']='automatic/name';
$obraz['Name']='image.gif';
$obraz['Disposition']='inline';
#$obraz['Cache']=1;

I tried

$message_object->Send();
unset($message_object);

but have the same effect.

So probably CreateFileImage function is making cache of the image files no mather of $obraz['Cache']=1 parameter, I didn't found any function to destruct it permamently.

Have you any suggestion?

  2. Re: Allowed memory size of xxx bytes...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-03-07 02:37:38 - In reply to message 1 from Arek Koc
If the message is different for every user, you should call the ResetMessage() function before composing the message for each new user.

  3. Re: Allowed memory size of xxx bytes...   Reply   Report abuse  
Picture of Arek Koc Arek Koc - 2013-03-07 10:04:35 - In reply to message 2 from Manuel Lemos
I've seen this function but for example what if I have 2 objects with different messages?
ResetMessage() don't get any arguments so which of the object will be reseted? First of the declared? Second? Both?

  4. Re: Allowed memory size of xxx bytes...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-03-07 11:45:05 - In reply to message 3 from Arek Koc
That is a function to call on a given object. So it only resets the definition of the last message that it sent. Other objects are not affected.