Mail_Queue memory problems (mem leak ???)

From: Date: Mon, 23 Dec 2002 16:47:48 +0000
Subject: Mail_Queue memory problems (mem leak ???)
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-11817@lists.php.net to get a copy of this message
I have a script which adds 6000 registered users to the mail queue. The script runs a select on the database and then for each one adds an entry to the mail queue with the following code fragment $res = $db->query($sql); $data = $res->fetchRow(DB_FETCHMODE_ASSOC); while(1){ $hdrs = array( 'To' => $user, 'From' => $from, 'Reply-To' => $from, 'Subject' => $subject ); $mail_queue = new Mail_Queue($db_options, $mail_options); $user = $data['email']; $hdrs = $mime->headers($hdrs); $mail_queue->put( $from, $user, $hdrs, str_replace('{$email}', $user, $body) ); print("Added $user [".$data['mailid']."] to the queue\n"); $data = $res->fetchRow(DB_FETCHMODE_ASSOC); if(!$data || DB::isError($data)){ break; } } after around 1000 used I get this error. Added email@domain.com [954] to the queue <br /> <b>Fatal error</b>: Allowed memory size of 62914560 bytes exhausted (tried to allocate 59134 bytes) in <b>/usr/share/pear/Mail/Queue/Container/db.php</b> on line <b>173</b><br /> <br /> <b>Fatal error</b>: Allowed memory size of 62914560 bytes exhausted (tried to allocate 35 bytes) in <b>/usr/share/pear/PEAR.php</b> on line <b>632</b><br /> I have tried to allocate more memory (up to 350MB for PHP but this does not help to complete the 6000 user operation). I suspect there is a memory leak but I did not manage to find it. It could also be a preblem in any of the classes Mail_Queue uese but I have used PEAR DB for quite large operations in the past and I have not seen problems for 50K rows. Maybe in the mail package ??? Can the author of mail queue have a look at this. Yavor Shahpasov

« previous php.pear.dev (#11817) next »