Bug #62467 [Opn->Wfx]: SimpleXML memory usage is not reported by memory_get_usage()
| From: | cataphract@php.net | Date: | Thu, 05 Jul 2012 08:00:56 +0000 |
| Subject: | Bug #62467 [Opn->Wfx]: SimpleXML memory usage is not reported by memory_get_usage() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-171747@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62467&edit=1
ID: 62467
Updated by: cataphract@php.net
Reported by: zerkyn at gmail dot com
Summary: SimpleXML memory usage is not reported by
memory_get_usage()
-Status: Open
+Status: Wont fix
Type: Bug
Package: SimpleXML related
Operating System: Windows, Linux
PHP Version: 5.3.14
Block user comment: N
Private report: N
New Comment:
This can't be fixed; PHP doesn't control the way libxml2 does the allocations.
Previous Comments:
------------------------------------------------------------------------
[2012-07-02 19:45:46] zerkyn at gmail dot com
Description:
------------
When using SimpleXML functions to load XML data, the memory consumption is not tracked internally by
PHP.
Calling the "memory_get_usage()", you can see only a light memory consumption increase,
which is clearly not an appropriate value for the document loaded (it is easily seen on a big
documents, e.g. 1Mb+). However, the proper memory increase is observed by using system tools
('tasklist /FI "PID eq ..."' under Windows, 'ps' under Linux).
The issue affects profiling scripts, which are not able to fulfill their role. And it affects
'memory_limit' setting, which doesn't control application memory, consumed by
SimpleXML.
Test script:
---------------
<?php
echo "Memory usage before: ", memory_get_usage(), "\n";
echo "Sys memory usage before: ", SystemMemoryUsage(), "\n";
$xml = simplexml_load_file('pretty_big_file_of_1mb_size.xml');
echo "Memory usage after: ", memory_get_usage(), "\n";
echo "Sys memory usage after: ", SystemMemoryUsage(), "\n";
/** -------------------------------------- */
function SystemMemoryUsage()
{
... // Return memory consumption by executing system tool - tasklist, ps or anything else
}
Expected result:
----------------
"Memory usage after" and "Sys memory usage after" show, that memory consumption
was increased by approximately same values.
Actual result:
--------------
"Memory usage after" shows light memory consumption increase, while "Sys memory usage
after" shows much bigger value.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62467&edit=1