php.net |  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
Votes:2
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
Description:
------------
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:
---------------
<?php
  $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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-21 11:07 UTC] nlopess@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip


 [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: Fri Mar 29 12:01:27 2024 UTC