2009年10月23日星期五

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

Can you provide the ZF version you were using, the adapter, and version
of PHP?

-ralph

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
>>
>>
>>
>

没有评论: