views:

29

answers:

1

I'm trying to parse an HTML file with simplehtmldom and I'm getting this error:

zend_mm_heap corrupted

after about 4 seconds of execution on a 8231 lines HTML file. Could this be a bug or just excessive memory usage?

+1  A: 

There is a bug that affects most PHP5.2 and above, and can (albeit not always consistently) affect any application that works with large numbers of objects, particularly when the server is heavily loaded; but does leave a "zend_mm_heap corrupted" message in the apache logs.

One possible solution is to add the line: export USE_ZEND_ALLOC=0 to the apache envvars file

Mark Baker
Yep that got rid of the error, but does that mean that the script is using too much memory? I have problems getting simplehtmldom to work on that file.
kemp
Too much memory generally triggers an out of memory error; and I think that if it was that simple, the PHP dev team would have been able to fix it by now... but this seems an intermittent error triggered when PHP is allocating too many small chunks of memory very quickly, and the memory used by the many objects is fragmenting
Mark Baker
I'm experiencing exactly the same problem and I tried disabling the Zend Memory Manager as suggested. That was not helping, however. With USE_ZEND_ALLOC=0 I'm no longer getting the "zend_mm_heap corrupted" error but the Apache process segfaults instead.
cg