|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-05-16 11:03 UTC] rrichards@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 20 00:00:02 2025 UTC |
Description: ------------ If xpath->query is used in combination with namespaces in the xml document it produces a memory leak. The memory leak couldn't be identified with memory_get_usage. Only top could show us the raising memory usage. Reproduce code: --------------- #!/usr/local/apache2/bin/php <?php $xml_str = '<?xml version="1.0" encoding="UTF-8"?> <items xmlns:a="http://www.example.org/" xmlns:b="http://www.example2.org/" xmlns:c="http://www.example3.org/" > <header>Item1</header> <item>Data</item> </items> '; $xml_dom = DomDocument::loadXML( $xml_str ); $xpath = new domXPath( $xml_dom ); for( $i=0; $i< 1000000; $i++ ) { $node_list = $xpath->query( '/*' ); } ?> Expected result: ---------------- The memory usage of the above code WITHOUT the namespace definition is 1.1% (using top). Actual result: -------------- The memory usage of the above code WITH the namespace definition is starting by 1.1% and raising up to 7.4%(using top).