#37458 [Opn->Bgs]: XPath Memory Leak

From: Date: Tue, 16 May 2006 11:04:03 +0000
Subject: #37458 [Opn->Bgs]: XPath Memory Leak
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-97175@lists.php.net to get a copy of this message
ID: 37458 Updated by: rrichards@php.net Reported By: lars dot kirchhoff at unisg dot ch -Status: Open +Status: Bogus Bug Type: DOM XML related Operating System: Linux PHP Version: 5.1.4 New Comment: Not a PHP issue. Leak is in libxml2. will be fixed there. Previous Comments: ------------------------------------------------------------------------ [2006-05-16 08:11:00] lars dot kirchhoff at unisg dot ch 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). ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37458&edit=1

« previous php.bugs (#97175) next »