|  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
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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-20 18:41 UTC]
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: Tue Jun 25 08:01:29 2024 UTC