Bug #62467 [NEW]: SimpleXML memory usage is not reported by memory_get_usage()
| From: | zerkyn at gmail dot com | Date: | Mon, 02 Jul 2012 19:45:46 +0000 |
| Subject: | Bug #62467 [NEW]: SimpleXML memory usage is not reported by memory_get_usage() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-171699@lists.php.net to get a copy of this message | ||
From: zerkyn at gmail dot com
Operating system: Windows, Linux
PHP version: 5.3.14
Package: SimpleXML related
Bug Type: Bug
Bug description:SimpleXML memory usage is not reported by memory_get_usage()
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 bug report at https://bugs.php.net/bug.php?id=62467&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62467&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62467&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62467&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=62467&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62467&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=62467&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=62467&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=62467&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=62467&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=62467&r=support
Expected behavior: https://bugs.php.net/fix.php?id=62467&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=62467&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=62467&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=62467&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62467&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=62467&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=62467&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=62467&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=62467&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=62467&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=62467&r=mysqlcfg