ID: 14037 User updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Old Status: Feedback Status: Open Bug Type: DOM XML related Operating System: Linux PHP Version: 4.0.6 New Comment:
Here's the explanation from [EMAIL PROTECTED] (our resident C expert): In the ext/domxml/php_domxml.c there is a destructor function named php_free_xml_doc(). In the loop code that [EMAIL PROTECTED] has posted this destructor function gets invoked after the end of the loop which for some reason won't free up memory. We thought maybe the xmldoc memory should be released within the loop that is after getting an xmldoc object into $doc and before overwriting it through the next iteration of the loop. So we added our own xmldocfree( $doc ) function and put it in the loop. We had no memory leak anymore but then we encountered segfaults in the apache log file which of course was because of the native destructor being invoked on an already released object. So maybe even our xmldocfree wasn't working properly and the segfault was somehow cleaning up everything behind. But anyway we are happy now because the memory leak is gone and the segfault does not effect our functionality. Previous Comments: ------------------------------------------------------------------------ [2001-11-29 09:48:25] [EMAIL PROTECTED] By patching what? ext/domxml? FYI, apache doesn't release memory it once grabs. Thats how it works. Feedback. ------------------------------------------------------------------------ [2001-11-29 09:42:22] [EMAIL PROTECTED] As stated, the memory used by Apache sky rockets... On my machine, it goes up to about 90% or so. We're working on a patch to this bug, we've got the memory leak fixed by closing the file using a function we wrote, but unfortunately that ended up causing a segfault in Apache. When we fix that problem, we'll post the fix here. ------------------------------------------------------------------------ [2001-11-29 09:38:04] [EMAIL PROTECTED] What do you define as 'memory leak' ? Error output in apaches log? Feedback. ------------------------------------------------------------------------ [2001-11-12 17:01:15] [EMAIL PROTECTED] <?php echo "starting test ...<p>"; flush(); for ($i=0; $i<100; $i++) { $doc = xmldocfile( "SOMEXMLFILE" ); } echo "test finished"; ?> When this is done on Apache, the memory used by Apache sky rockets. The larger the XML file, the larger the memory leak. ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=14037&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]