php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37996 Memory Allocation Failed
Submitted: 2006-07-03 12:27 UTC Modified: 2006-07-03 14:07 UTC
From: GastonRobledo at gmail dot com Assigned:
Status: Not a bug Package: *XML functions
PHP Version: 5.1.4 OS: XP, Linux
Private report: No CVE-ID: None
 [2006-07-03 12:27 UTC] GastonRobledo at gmail dot com
Description:
------------
Hi, i recive this message when i try to parse the xml file.

Memory allocation failed : growing buffer..

The filesize of the XML is 365.852 KB; 350 MB.

in the PHP.ini the memory_limit = 450 M.
but i always recive the message.

Reproduce code:
---------------
this is the code:

function xml2php($file) {

		$xml_parser = xml_parser_create();
		if (!$fp = fopen($file, "r")) {
			die("unable to open XML");
		}
		$contents = fread($fp, filesize($file));
		fclose($fp);
		xml_parse_into_struct($xml_parser, $contents, $arr_vals);
		xml_parser_free($xml_parser);

		$this->arr_xml = $arr_vals;

	}


Expected result:
----------------
Nothing...


Actual result:
--------------
Memory allocation failed : growing buffer..

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-03 12:51 UTC] tony2001@php.net
Please provide full error messages and not just parts of them.
Apparently I can't reproduce it without your 350Mb XML file and there is no such error message in PHP, so.. where exactly it comes from? Which line, function etc.? 
 [2006-07-03 14:07 UTC] rrichards@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

You are running out of system memory. error issued from libxml.
With this amount of data, this is a really good reason why you should stream the input rather than try to load it all at once and not create in memory trees/structures of it.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC