PHP 4.0 Bug #3387: memmory leak with example

From: Date: Wed, 02 Feb 2000 19:46:48 +0000
Subject: PHP 4.0 Bug #3387: memmory leak with example
Groups: php.dev 
Request: Send a blank email to php-dev+get-15152@lists.php.net to get a copy of this message
From: wico@cnh.nl Operating system: linux rh-6.1 PHP version: 4.0 Latest CVS (02/02/2000) PHP Bug Type: Scripting Engine problem Bug description: memmory leak with example Revert_Array_Layout_2 will use fast memmory without freeing it when done (result hanging machine, out of memmory) Revert_Array_Layout_3 is the same as *_2 and will not use the memmory i guess you can figure out where's the bug (list or each i think) P.S Make the array bigger and you will crash faster :) <? function Revert_Array_Layout_2 ($wico) { while (list($key, $value) = each($wico)) { $revert[$value] = $key; } return($revert); } function Revert_Array_Layout_3 ($wico) { $total = count($wico); for ($x = 0; $x < $total; $x++) { $revert[$wico[$x]] = $x; } return($revert); } function Get_Unique_Array_Values_2($wico) { return(Revert_Array_Layout_2(Revert_Array_Layout_2($wico))); } for ($y = 0; $y < 100000; $y++) { unset($wico); for ($x = 0; $x < 20; $x++) { $wico[$x] = "$x"; $wico[$x + 1] = "$x"; $x++; } $temp = Get_Unique_Array_Values_2($wico); } ?>

« previous php.dev (#15152) next »