ID: 44665 User updated by: sasha at integrate dot ru Reported By: sasha at integrate dot ru Status: Open Bug Type: Arrays related Operating System: Linux PHP Version: 5.2.5 New Comment:
sorry - wrong second link the right link is http://ver.web.integrate.ru/test2.php Previous Comments: ------------------------------------------------------------------------ [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