Running PHP 5.3.6 under MAMP on MAC, the memory usage increases every x calls (between 3 and 8) until the script dies from memory exhaustion. How do I fix this?
Using libxml_use_internal_errors(true); suppresses error output but builds a continuous log of errors which is appended to on each loop. Either disable the internal logging and suppress PHP warnings, or clear the internal log on each loop iteration like this:
loadHTML(file_get_contents('ebay.html'));
unset($dom);
libxml_use_internal_errors(false);
libxml_use_internal_errors(true);
echo memory_get_peak_usage(true) . "\r\n"; flush();
}
?>