#44665 [Opn->Bgs]: Memory leak in array_push operation
| From: | jani@php.net | Date: | Tue, 08 Apr 2008 10:57:52 +0000 |
| Subject: | #44665 [Opn->Bgs]: Memory leak in array_push operation | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-124074@lists.php.net to get a copy of this message | ||
ID: 44665
Updated by: jani@php.net
Reported By: sasha at integrate dot ru
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: Linux
PHP Version: 5.2.5
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Previous Comments:
------------------------------------------------------------------------
[2008-04-08 00:13:53] sasha at integrate dot ru
sorry - wrong second link
the right link is
http://ver.web.integrate.ru/test2.php
------------------------------------------------------------------------
[2008-04-07 22:35:43] sasha at integrate dot ru
Description:
------------
Sorry for my english
php with curl, dbase, dom, gd2, mbstring,pgsql, simplexml,soap,sockets
It running under eAccelerator, but when I turn it off, the result is
just the same.
actually we use only pgsql. we get request (rather big - more than 3000
rows in result) making array of objects and then trying to convert each
object into html string. converted string (each about 2 Kb length) have
been pushed into array
very soon memory usage growing to 64 Mb and script is crushed
This problem is solved by method refact
protected function _refact($arr)
{
$myarr=array();
while(!empty($arr)) $myarr[]=array_shift($arr);
return ($myarr);
}
I call this function after 75, 150, 300 etc iterations, but calling
this function reduce performance. Is that behaviour (I mean memory usage
growing) normal?
Reproduce code:
---------------
Normal script (crushed)
http://ver.web.integrate.ru/test1.php
Cheated script (with refact method)
http://ver.web.integrate.ru/test1.php
Each script reports tht Init memory (Memory at the begin), how much
objects it proceeds (Now showing), iteration counter (Cicling
iteration), current memry usage (current memory usage) and length of
string we pushed into array (string_length).
Cheated script (in red hrs) show also the length of array we throw to
refact method
Expected result:
----------------
I guess that the memory usage won't grow while running this script
because the array of objects poped every turn, and the volume of each
element of this array more than the volume of elements of the result
array
Actual result:
--------------
U can see it on url I submit
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44665&edit=1