php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3387 memmory leak with example
Submitted: 2000-02-02 14:46 UTC Modified: 2000-02-02 14:57 UTC
From: wico at cnh dot nl Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0 Latest CVS (02/02/2000) OS: linux rh-6.1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: wico at cnh dot nl
New email:
PHP Version: OS:

 

 [2000-02-02 14:46 UTC] wico at cnh dot nl
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);
	}

?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-02-02 14:51 UTC] andrei at cvs dot php dot net
There was a fix today related to list() problem. Can you update to 
latest CVS and try again?
 [2000-02-02 14:57 UTC] zeev at cvs dot php dot net
As Andi told you earlier, this bug was fixed.  You should update to the latest CVS (make sure you also cvs update Zend, and that you create a clean build).
I ensured that the bug was gone by running your script, and it doesn't leak a single byte (nor does it crash).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 11 01:01:32 2024 UTC