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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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 24 13:01:31 2024 UTC