|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-07-05 08:00 UTC] cataphract@php.net
[2012-07-05 08:00 UTC] cataphract@php.net
-Status: Open
+Status: Wont fix
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 12:00:01 2025 UTC |
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.