2009年10月22日星期四

Re: [fw-db] Memory Leak in Zend_Db_Table?

Hi Daniel,

You should first try to update your ZF to the latest version 1.9.*.

I am pretty sure that your memory leak will disappear.


Warm Regards,
Stephane Fillon
On 23/10/2009, at 4:38 PM, Nghia Doan wrote:


Hi All,
I have the same proplem.
who can help me ?

Thanks
Nghia Doan


Daniel Freudenberger-2 wrote:

Hello,



I wrote a cli script that updates about 23.000 records once a day. But
after
several thousand records have been updated, the script used more than
128mb
of memory. I'm not quiet sure if it's a zend_db_table or php related
issue.



I wrote a little test-script to reproduce the memory leak. I'm running zf
1.0.2 and php 5.2.3 (cli / win32).



<?php

 protected function indexAction ()

 {

   $playcom = new PlaycomItems(); // just one table that extends
Zend_Db_Table and sets the required $_name property

   $limit = 10;



   for($offset = 0; $offset < 10000; $offset += $limit) {

     $rows = $playcom->fetchAll(null, 'id ASC', $limit, $offset);

     echo memory_get_usage(true) . ' / ' . memory_get_usage(false) . "
bytes in use.\n";

     unset($rows); // should not be necessary, but makes no difference
anyway

   }

 }

?>



The output looks like this:

4456448 / 4371232 bytes in use.

4456448 / 4374144 bytes in use.

4456448 / 4376784 bytes in use.

4456448 / 4378840 bytes in use.

4456448 / 4381504 bytes in use.

4718592 / 4384176 bytes in use.

4718592 / 4386832 bytes in use.

4718592 / 4389392 bytes in use.

4718592 / 4391976 bytes in use.

4718592 / 4394632 bytes in use.

4718592 / 4397192 bytes in use.

4718592 / 4399736 bytes in use.

4718592 / 4402408 bytes in use.

......





Any help is appreciated,

Daniel




--
View this message in context: http://www.nabble.com/Memory-Leak-in-Zend_Db_Table--tp13058095p26021546.html
Sent from the Zend DB mailing list archive at Nabble.com.


没有评论: