Page 1 of 1

Fatal error: Allowed memory size ... exhausted (code inside)

Posted: Tue Oct 15, 2002 1:58 pm
by dd3123
Ok, here's the small block of code so far, and $contents holds a comma delimited file's contents (clever huh):


...

$contentlines = explode("\n" , $contents);
unset($contents);
while(list($key, $value) = each($contentlines))
{

$contentarray = explode("," , $value);
list($tracking, $email, $orderid) = $contentarray;
{
$ups = new ssl_ups("$upskey", "$upsid", "$upspass");
$ups->SetUrl("https://www.ups.com/ups.app/xml/Track");
$ups->Post("$tracking");
if ($ups->GetStatus() == "done")
{
$result = $ups->GetResultArray();
while(list($key2, $value2) = each($result))
{
echo "[$key2] => $value2<br>\n";
}
}
unset($ups);
flush();
}
}

...


My problem is, on my 30th post to the server, I run out of memory when XPath (an XML class which is used by my UPS class) looks at the results (which are no bigger than any previous results). I would have thought that unset would have freed up my previously used memory in $ups?

Any thoughts on how to get this to work past 30?

Posted: Tue Oct 15, 2002 6:11 pm
by volka
consider using

Code: Select all

$fd = fopen('the.file', 'r');
while($value = fgets($fd, 1024) )
{ ...
if you think there is a memory-hole in PHP/XSLT/XML-implementation try to track it down and post a bug report ;)

btw: welcome Image