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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: poon dot fung at gmail dot com
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Fri May 10 22:01:32 2024 UTC