title: PHP PEAR Container error
body: <p>Allrighty, it's the first time I ask a question here. My problem is as awkward as it is difficult to get to the bottom of.
  Story goes like this: I have this little system, which sends alot of e-mail invitations(not spam). So, being sensible, I don't use the PHP function mail(),
  I use PEAR classes like Mail, Mail_Queue, Net_SMTP, etc.
  Only problem is, my error logs fill up with tons of errors like this:</p>
  
  <pre><code>PHP Notice:  Error in sending mail: 
  Mail Queue Error: Cannot initialize container in /usr/lib/php/PEAR.php on line 873
  </code></pre>
  
  <p>And then, of course:</p>
  
  <pre><code>[18-Feb-2011 17:38:44] PHP Fatal error:  
  Allowed memory size of 33554432 bytes exhausted 
  (tried to allocate 3 bytes) in /usr/lib/php/PEAR.php on line 844
  </code></pre>
  
  <p>Here's the code which inits the mail queue(inside a class called Newsletter)</p>
  
  <pre><code>//I know passing the DSN as the string is kind of deprecated, 
  //but it;'s the only way it works on my system
  $dsn ="mysql://$db_user:$db_pass@$db_host/$db_name";
  $db_options = array();
  $db_options['type']       = 'db';
  $db_options['dsn']        = $dsn;
  $db_options['mail_table'] = TABLE_QUEUE;
  
  $this-&gt;host = '-- valid host here --';//data in these strings has been obscured
  $this-&gt;username = '-- valid username here --';
  $this-&gt;password = '-- valid password here --';
  
  //optionally, a 'dns' string can be provided instead of db parameters.
  //look at DB::connect() method or at DB or MDB docs for details.
  //you could also use mdb container instead db
  //$server = isset($_SERVER['SERVER_NAME'])?$_SERVER['SERVER_NAME']:'localhost';
  $mail_options = array(
      'driver'   =&gt; 'smtp',
      'host'     =&gt; $this-&gt;host,
      'port'     =&gt; 25,
      'auth'     =&gt; true,
      'username' =&gt; $this-&gt;username,
      'password' =&gt; $this-&gt;password,
  );
  $this-&gt;mail_queue = new Mail_Queue($db_options, $mail_options);
  </code></pre>
  
  <p>Some more code down the line, </p>
  
  <pre><code>public function sendChunk($start, $count)
  {
      global $db;
      $ids = $db-&gt;get_results("SELECT DISTINCT id_user as id FROM ".TABLE_QUEUE);
      $ret = array();
      foreach ($ids as $id)
          $ret[] = $id-&gt;id;
      unset($ids);        
      $this-&gt;mail_queue-&gt;sendMailsInQueue($count, $start, 1);
      return true;
  }
  </code></pre>
  
  <p>Problem is, I double checked every line of code I wrote, and it's doing it's job. Only problem is that sometimes it refuses to send any mails.
  Thanks in advance for replies.</p>