Bug #54120 [Opn->Bgs]: Impossible to freed memory complety after call to Xpath() method.
| From: | rrichards@php.net | Date: | Tue, 01 Mar 2011 19:54:31 +0000 |
| Subject: | Bug #54120 [Opn->Bgs]: Impossible to freed memory complety after call to Xpath() method. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-159131@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=54120&edit=1
ID: 54120
Updated by: rrichards@php.net
Reported by: ikaos at gmx dot fr
Summary: Impossible to freed memory complety after call to
Xpath() method.
-Status: Open
+Status: Bogus
Type: Bug
Package: SimpleXML related
Operating System: Linux CentOS 5.5 x86_64
PHP Version: 5.3.5
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Memory is freed. http://xmlsoft.org/xmlmem.html you can
read how memory
is managed
and might not be returned immediately to the kernel.
Previous Comments:
------------------------------------------------------------------------
[2011-02-28 15:58:00] ikaos at gmx dot fr
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 this bug report at http://bugs.php.net/bug.php?id=54120&edit=1