|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39438 Memory leak PHP Fatal error: Out of memory
Submitted: 2006-11-08 20:33 UTC Modified: 2006-12-01 20:08 UTC
Avg. Score:4.8 ± 0.5
Reproduced:33 of 34 (97.1%)
Same Version:33 (100.0%)
Same OS:4 (12.1%)
From: nikolas dot hagelstein at gmail dot com Assigned: dmitry (profile)
Status: Closed Package: Unknown/Other Function
PHP Version: 5.2.0 OS: NETBSD 3.0.1 AMD64
Private report: No CVE-ID: None
 [2006-11-08 20:33 UTC] nikolas dot hagelstein at gmail dot com
After upgrading to php 5.2.0 im constantly receiving "PHP Fatal error:  Out of memory error" where i did not received one using 5.1.6. I adjusted the memory limit from 64M to 256M but without any success.

PHP Fatal error:  Out of memory (allocated 250871808) at /usr/pkgsrc/www/ap-php/work/php-5.2.0/ext/standard/var.c:541 (tried to allocate 2215827 bytes) in /var/www/shared/typo3_src-4.0.1/typo3/mod/tools/em/class.em_xmlhandler.php on line 141, referer:

i am not sure about how to dig into this but i can say that it  seems to be somehow xml/serialize related.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-08 20:46 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

 [2006-11-08 21:40 UTC] nikolas dot hagelstein at gmail dot com
   'a1_teasermenu' => array(
   		'downloadcounter' => 2777,
        'versions' => array(
        	'0.1.0' => array (
        		'title' => 'A1 Teasermenu',
        	    'description' => 'Displays a teaser for advanced subpages or a selection of advanced pages',
        	    'state' => 'stable',
        	    'reviewstate' => 0,
        	    'category' => 'plugin',
        	    'downloadcounter' => 2787,
        	    'lastuploaddate' => 1088427240,
        	    'dependencies' => array (
        	          'depends' => array(
        	                  'typo3' =>'', 
        	                  'php' =>'', 
        	                  'cms' => ''
        	          'conflicts' => array('' =>'')        	
        	  	'authorname' => 'Mirko Balluff',
        	  	'authoremail' => '',
        	  	'ownerusername' => 'amt1',
        	  	't3xfilemd5' => '3a4ec198b6ea8d0bc2d69d9b7400398f',
while($i<1600) {	

results in :
PHP Fatal error:  Allowed memory size of 67108864 bytes exhausted at /usr/pkgsrc/lang/php5/work/php-5.2.0/ext/standard/var.c:541 (tried to allocate 1041720 bytes) in /var/www/ on line 37

while it works on php 5.1.6 and 4.
Having mem limit set to 64MB.

Setting mem limit to 128MB and increasing interations to 2260 also causes the above mentioned error.
 [2006-11-08 21:56 UTC] nikolas dot hagelstein at gmail dot com
Did some further testing:
the script worked on:
PHP 5.1.6-5 (cli) (built: Oct 28 2006 13:49:33) Memlimit:8mb
PHP 5.1.6-5 (cli) (built: Oct 28 2006 13:49:33) Memlimit:64MB
 [2006-11-27 10:45 UTC] stig at 8620 dot dk
Are there current any work arounds for this problem?
My host has upgraded to 5.2.0, so I'm stuck with this problem.
 [2006-11-27 12:40 UTC] nikolas dot hagelstein at gmail dot com
No workarounds atm i had to downgrade :|
 [2006-11-27 19:28 UTC] lmiranda at lumigo dot net
I had this problem with my forum, after some time it showed:

Fatal error: Out of memory (allocated 786432) (tried to allocate 1572864 bytes)

I tried to set memory_limit from 16M to 64M, and it didn't work.

I've downgraded to 5.1.6
 [2006-11-27 20:11 UTC] phpbugs at thequod dot de
Just for info: I've experienced memory usage bumping since 
somewhere after 5.2.0RC2 and current CVS.
(phpDocumentor needs more than 256M with 5.2.1-dev, but 
not with 5.2.0RC3-dev)
 [2006-11-29 15:35 UTC] samuel at dragonboricua dot net
I started receiving this error on my WordPress blog since I upgraded to php 5.2.0 from 5.1.6, but seems that after a refresh it goes away (running on FastCGI on Apache). Sometimes it requires a few refreshes for it to go away, but it is never too constant.
 [2006-11-29 19:55 UTC] phpbugs at thequod dot de
I withdraw my previous comment, the RC3-build was 
without "--enable-memory-limit". Sorry.

I've found that
$i = 0;
$a = array();
while( $i++ < 100000 )
        $a[] = 'a';
echo memory_get_usage();
uses a lot more memory. I cannot say, if this is because 
of the more accurate memory manager reporting.

I'm surprised how much memory is needed for 100.000 "a"'s 
in an array..

$ php -f test2.php
daniel@base [stp:2] { ~/bugs/php/memoryusage }
$ php5 -f test2.php


$ php -v
PHP 5.2.1-dev (cli) (built: Nov 27 2006 03:16:44)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend 

$ php5 -v
PHP 5.1.6 (cli) (built: Nov  2 2006 12:49:10)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend 
 [2006-12-01 20:08 UTC]
Fixed in CVS HEAD and PHP_5_2.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 16 15:01:28 2024 UTC