|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40184 Memory leak in SimpleXML ?
Submitted: 2007-01-21 08:12 UTC Modified: 2007-01-29 01:00 UTC
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: florence at post dot harvard dot edu Assigned:
Status: No Feedback Package: SimpleXML related
PHP Version: 5.2.0 OS: Win XP
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2007-01-21 08:12 UTC] florence at post dot harvard dot edu
Configure Command => cscript /nologo configure.js  "--enable-snapshot-build" "--with-gd=shared"
Using php.ini-recommended
I am trying to parse about 4,000 xml files (each about 100-900KB in size). The script I am using simplexml_load_file(). I get an out of memory error after about 800 files.

I found bug #38604 and ran the script from that report (I copied it below) and quickly got the out of memory error.
Bug #38604 says "This bug has been fixed in CVS."  Was this really fixed or was the bug report just closed? If it was really fixed, is the fix in 5.2.0?

Reproduce code:
  $xml = '<root><node></node></root>';
  $xmldata = simplexml_load_string($xml);
  while (true) {
    $foo = $xmldata->node;
    foreach ($foo as $node)

Actual result:
G:\x>php test_bug38604.php
PHP Fatal error:  Out of memory (allocated 839122944) (tried to allocate 2013265
92 bytes) in G:\x\test_bug38604.php on line 8


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-21 11:07 UTC]
Please try using this CVS snapshot:
For Windows:

 [2007-01-29 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 15 03:01:28 2024 UTC