I am using PHP Simple HTML DOM Parser and it is consuming a lot of memory (discovered from using memory_get_usage)! I tried unsetting it but it doesn't do anything.
2 Answers
See http://simplehtmldom.sourceforge.net/manual_faq.htm
Q: This script is leaking memory seriously... After it finished running, it's not cleaning up dom object properly from memory..
A: Due to php5 circular references memory leak, after creating DOM object, you must call dom->clear() to free memory if call file_get_dom() more then once.
Example:
$html = file_get_html(...); // do something...
$html->clear();
unset($html);
This happens a lot when you are using this library in a loop.
1 Comment
shaharsol
He should have put this FAQ in BOLD on the Homepage of the library site. That said, it is an awesome and very useful library, and now it can finally run in loop without crashing!