From: florence at post dot harvard dot edu Operating system: Win XP PHP version: 5.2.0 PHP Bug Type: SimpleXML related Bug description: Memory leak in SimpleXML ?
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 -- Edit bug report at http://bugs.php.net/?id=40184&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40184&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40184&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40184&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40184&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40184&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40184&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=40184&r=needscript Try newer version: http://bugs.php.net/fix.php?id=40184&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40184&r=support Expected behavior: http://bugs.php.net/fix.php?id=40184&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40184&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40184&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40184&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40184&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40184&r=dst IIS Stability: http://bugs.php.net/fix.php?id=40184&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40184&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40184&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40184&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=40184&r=mysqlcfg