note 14760 rejected from function.xpath-eval by jimw

From: Date: Mon, 22 Oct 2001 19:18:12 +0000
Subject: note 14760 rejected from function.xpath-eval by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-19287@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!

« previous php.notes (#19287) next »