php commandline: memory size exhausted
Posted: Tue Aug 03, 2010 12:25 pm
[PROBLEM]
Just ran into the following error:
Caused by a call to php-tidy's "parseString()" function.
[SOLUTION]
Although there was a known issue with php5-tidy regarding bad memory management (Debian bug tracking: #463872, 464074), it was simply bad programming in my case:
I had a hidden recursion that caused the generated XML to grow beyond reasonable size.
To figure that out, I just saved the to-be-parsed XML-string into a temporary file:
So, if you also run into this error, maybe you should also check the xml string you're forwarding to tidy->parseString().
Just ran into the following error:
Code: Select all
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 1817779 bytes) in /home/ferry/mthk/trunk/src/include/MthkXML.php on line 180
[SOLUTION]
Although there was a known issue with php5-tidy regarding bad memory management (Debian bug tracking: #463872, 464074), it was simply bad programming in my case:
I had a hidden recursion that caused the generated XML to grow beyond reasonable size.
To figure that out, I just saved the to-be-parsed XML-string into a temporary file:
Code: Select all
file_put_contents('/tmp/xml-tidy-debug.xml', $xml_string);