note 14760 added to function.xpath-eval.php
| From: | dante at lorenso dot com | Date: | Mon, 13 Aug 2001 21:10:11 +0000 |
| Subject: | note 14760 added to function.xpath-eval.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-16660@lists.php.net to get a copy of this message | ||
Try the following code and watch your memory get wasted like crazy...
$doc =
xmldoc("<work><sample><test></test></sample></work>");
$econtext = xpath_new_context($doc);
for ($i=0; $i<100000; $i++) {
xpath_eval($econtext, "//test");
}
Does anybody have advice on how to clean up memory after an 'eval' is done? Apparently
each eval uses more and more memory such that a page with many evals is likely to cause your apache
process to segfault and/or spew errors like this:
xmlBufferAdd : out of memory!
xmlBufferAdd : out of memory!
xmlBufferAdd : out of memory!
xmlBufferAdd : out of memory!
xmlBufferAdd : out of memory!
FATAL: emalloc(): Unable to allocate 5121 bytes
Help/suggestions would be appreciated!
http://www.php.net/manual/en/function.xpath-eval.php