|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-06-15 11:36 UTC] tom dot denbraber at moxio dot com
[2018-06-22 13:17 UTC] tom dot denbraber at moxio dot com
[2018-06-22 14:35 UTC] nikic@php.net
-Status: Open
+Status: Duplicate
[2018-06-22 14:35 UTC] nikic@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 16:00:01 2025 UTC |
Description: ------------ XMLReader::expand does not free its allocated memory. When executing the test script below using the CLI, the memory usage is as expected. However, when serving the same script over HTTP (via Apache or nginx), the XMLreader::expand function does not free its memory. For larger XMLs, this is a problem. Because the problem only occurs when serving the script over HTTP, I do not know whether this is a 'Network Functions'-issue, and 'XML Reader'-issue or a 'Web Server'-issue. Feel free to re-categorize. Test script: --------------- <?php $xml_string = "<?xml version=\"1.0\"?> <items>"; for ($i = 0; $i < 50000; $i++) { $xml_string .= sprintf("<item id=\"bk%d\"></item>", $i); } $xml_string .= "</items>"; $reader = new XMLReader(); $reader->XML($xml_string); print memory_get_usage() . "\n"; while ($reader->read() === true) { $node = $reader->expand(); } print memory_get_usage() . "\n"; Expected result: ---------------- The first and second memory-usage prints should be roughly equal to each other (this happens when executing the script using the CLI). Actual result: -------------- When executed over HTTP, the second memory usage is a lot higher than the memory usage that was printed first. For the given script, often up to 66% higher.