php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39896 Massive memory leak
Submitted: 2006-12-20 10:20 UTC Modified: 2006-12-20 18:41 UTC
From: poon dot fung at gmail dot com Assigned: helly (profile)
Status: Not a bug Package: SimpleXML related
PHP Version: 5.2.0 OS: Windows XP
Private report: No CVE-ID: None
 [2006-12-20 10:20 UTC] poon dot fung at gmail dot com
Description:
------------
The combination of simplexml and htmlspecialchars() creates massive memory leak. In a about 500k calls to htmlspecialchars() on a value in simplexml, it eats up over 1GB of memory.


Reproduce code:
---------------
$xml = simplexml_load_file('some_xml_file.xml');
$val = '';

for ($index=0; $index<10000000; $index++)
{
	$val = htmlspecialchars($xml->title);
}


Expected result:
----------------
If you run the above script and watch Windows Task Manager, you will see memory usage continuous to go up non-stop.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-20 18:41 UTC] iliaa@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Dupe of bug #38604
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 19:01:30 2024 UTC