Bug #54120 [NEW]: Impossible to freed memory complety after call to Xpath() method.
From:
Operating system: Linux CentOS 5.5 x86_64
PHP version: 5.3.5
Package: SimpleXML related
Bug Type: Bug
Bug description:Impossible to freed memory complety after call to Xpath() method.
Description:
------------
---
From manual page: http://www.php.net/simplexmlelement.xpath
---
Test script:
---------------
<?php
$sxe = NULL; $nodes = NULL;
print("Without call to xpath method : " . PHP_EOL);
print("Memory before SXE : " . memory_get_usage() . PHP_EOL);
$sxe = new SimpleXMLElement("large_file.xml", 0, TRUE);
$sxe = NULL; $nodes = NULL;
print("Memory after freed memory : " . memory_get_usage() . PHP_EOL .
PHP_EOL);
$sxe = NULL; $nodes = NULL;
print("Calling xpath method : " . PHP_EOL);
print("Memory before SXE : " . memory_get_usage() . PHP_EOL);
$sxe = new SimpleXMLElement("large_file.xml", 0, TRUE);
$nodes = $sxe->xpath('/ITEMS/ITEM');
$sxe = NULL; $nodes = NULL;
print("Memory after freed memory : " . memory_get_usage() . PHP_EOL .
PHP_EOL);
// short sleep, time to launch 'ps aux'
sleep(10);
?>
Expected result:
----------------
When I unset (or set to NULL) the result of the Xpath() method ($nodes in
the example), I expect memory will be completly freed. It's not the case.
I tried, to recursively unset each element from $nodes and I got the same
result.
Actual result:
--------------
Result of the test script :
Without call to xpath method :
Memory before SXE : 625736
Memory after freed memory : 625904
Calling xpath method :
Memory before SXE : 625904
Memory after freed memory : 1608944
memory_get_usage says that few kilos octets of memory are still used, but
in reality several thousand mega octets are still used.
# ps aux | grep test.php
me 28859 83.4 48.3 *1119908* *996056* pts/3 S+ 15:30 0:08 /bin/php
test.php
--
Edit bug report at http://bugs.php.net/bug.php?id=54120&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54120&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54120&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54120&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54120&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54120&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54120&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54120&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54120&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54120&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54120&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54120&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54120&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54120&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54120&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54120&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54120&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54120&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54120&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54120&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54120&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54120&r=mysqlcfg
Thread (3 messages)
- ikaos at gmx dot fr