From: phpbugs at thequod dot de
Operating system: Ubuntu Linux
PHP version: 5CVS-2006-11-26 (CVS)
PHP Bug Type: Reproducible crash
Bug description: Segfault with "Allowed memory size exhausted"
Description:
------------
If the memory limit gets exhausted in a line like:
$a = new stdClass;
PHP segfaults during shutdown.
Reproduce code:
---------------
<?php
$o = new stdClass;
$i = 0;
while( ++$i )
{
$a = new stdClass;
$a->foo = rand(1000, 9999);
$a->bar = rand(1000, 9999);
$o->a[$i] = $a;
}
?>
Expected result:
----------------
No segmentation fault.
Actual result:
--------------
Fatal error: Allowed memory size of 16777216 bytes
exhausted (tried to allocate 40 bytes)
in /X/memory_usage1.php on line 8
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1218541376 (LWP 549)]
_zend_mm_free_int (heap=0x8606160, p=0x860624c)
at /PHP_5_2/Zend/zend_alloc.c:1332
1332 /PHP_5_2/Zend/zend_alloc.c: No such file or
directory.
in /PHP_5_2/Zend/zend_alloc.c
(gdb) bt
#0 _zend_mm_free_int (heap=0x8606160, p=0x860624c)
at /PHP_5_2/Zend/zend_alloc.c:1332
#1 0x0831a5e2 in zend_object_std_dtor (object=0xb6586ff0)
at /PHP_5_2/Zend/zend_objects.c:45
#2 0x0831a60a in zend_objects_free_object_storage
(object=0xb6586ff0) at /PHP_5_2/Zend/zend_objects.c:122
#3 0x0831d4ef in zend_objects_store_free_object_storage
(objects=0x8605988) at /PHP_5_2/Zend/zend_objects_API.c:89
#4 0x082f9b75 in shutdown_executor ()
at /PHP_5_2/Zend/zend_execute_API.c:299
#5 0x08304cf4 in zend_deactivate ()
at /PHP_5_2/Zend/zend.c:841
#6 0x082c9290 in php_request_shutdown (dummy=0x0)
at /PHP_5_2/main/main.c:1306
#7 0x083882ad in main (argc=3, argv=0xbf8aef94)
at /PHP_5_2/sapi/cgi/cgi_main.c:1792
--
Edit bug report at http://bugs.php.net/?id=39640&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=39640&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=39640&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=39640&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39640&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=39640&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39640&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39640&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39640&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39640&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39640&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=39640&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=39640&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39640&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39640&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39640&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39640&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39640&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39640&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39640&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39640&r=mysqlcfg