Running out of memory.
Posted: Fri Apr 11, 2003 8:43 pm
I have a script that needs to loop 11390625x's.
But i've run into a problem with
1) the script times out
2) the script runs out of memory
I can fix it timeing out but I don't know what to do about memory.
I've given php 900 meg to use, but thats not enough. :cry:
So is there anything I can do with the code to make it free memory?
[syntax=php]$num[1] = 1;
$num[2] = 2;
$num[3] = 3;
$num[4] = 4;
$num[5] = 5;
$num[6] = 6;
$num[7] = 7;
$num[8] = 8;
$num[9] = 9;
$num[10] = "a";
$num[11] = "b";
$num[12] = "c";
$num[13] = "d";
$num[14] = "e";
$num[15] = "f";
$x=1;
$f=1;
$e=1;
$d=1;
$c=1;
$b=1;
$a=1;
$count=1;
while($x==1){
$arr[$count] = $num[$a].$num[$b].$num[$c].$num[$d].$num[$e].$num[$f];
if($f==15){$f=0; $e++;}
if($e==15){$e=0; $d++;}
if($d==15){$d=0; $c++;}
if($c==15){$c=0; $b++;}
if($b==15){$b=0; $a++;}
if($a==15){$x=0;}
$f++;
$count++;
}[/syntax]
But i've run into a problem with
1) the script times out
2) the script runs out of memory
I can fix it timeing out but I don't know what to do about memory.
I've given php 900 meg to use, but thats not enough. :cry:
So is there anything I can do with the code to make it free memory?
[syntax=php]$num[1] = 1;
$num[2] = 2;
$num[3] = 3;
$num[4] = 4;
$num[5] = 5;
$num[6] = 6;
$num[7] = 7;
$num[8] = 8;
$num[9] = 9;
$num[10] = "a";
$num[11] = "b";
$num[12] = "c";
$num[13] = "d";
$num[14] = "e";
$num[15] = "f";
$x=1;
$f=1;
$e=1;
$d=1;
$c=1;
$b=1;
$a=1;
$count=1;
while($x==1){
$arr[$count] = $num[$a].$num[$b].$num[$c].$num[$d].$num[$e].$num[$f];
if($f==15){$f=0; $e++;}
if($e==15){$e=0; $d++;}
if($d==15){$d=0; $c++;}
if($c==15){$c=0; $b++;}
if($b==15){$b=0; $a++;}
if($a==15){$x=0;}
$f++;
$count++;
}[/syntax]