#37458 [NEW]: XPath Memory Leak
| From: | lars dot kirchhoff at unisg dot ch | Date: | Tue, 16 May 2006 08:11:00 +0000 |
| Subject: | #37458 [NEW]: XPath Memory Leak | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-97170@lists.php.net to get a copy of this message | ||
From: lars dot kirchhoff at unisg dot ch
Operating system: Linux
PHP version: 5.1.4
PHP Bug Type: DOM XML related
Bug description: XPath Memory Leak
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 bug report at http://bugs.php.net/?id=37458&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37458&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37458&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37458&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=37458&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=37458&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=37458&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=37458&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=37458&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=37458&r=support
Expected behavior: http://bugs.php.net/fix.php?id=37458&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=37458&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=37458&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=37458&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37458&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=37458&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=37458&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=37458&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=37458&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=37458&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=37458&r=mysqlcfg