Okay, that was quiet easy.

 

Thank you J

 

From: Simon Mundy [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 05, 2007 11:07 AM
To: Daniel Freudenberger
Cc: [email protected]
Subject: Re: [fw-general] Memory leak in Zend_Db_Table?

 

Hi Daniel - do you use the profiler? If it's set to 'true' then it will
start accumulating SQL statements as a log and thereby increasing the size
of the adapter object.





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

 

--

 

Simon Mundy | Director | PEPTOLAB

 

""" " "" """""" "" "" """"""" " "" """"" " """"" " """""" "" "

202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000

Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124

http://www.peptolab.com

 

Reply via email to