Bug #66372 [NEW]: Garbage collection issue
| From: | nikcomestotalk at gmail dot com | Date: | Tue, 31 Dec 2013 07:35:50 +0000 |
| Subject: | Bug #66372 [NEW]: Garbage collection issue | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-183506@lists.php.net to get a copy of this message | ||
From: nikcomestotalk at gmail dot com
Operating system: Linux
PHP version: 5.4.23
Package: *General Issues
Bug Type: Bug
Bug description:Garbage collection issue
Description:
------------
Memory getting exhausted when a php script[staticarray.php] is included
multiple times.
staticarray.php size is 221K and which contain only arrays
Example
memcheck.php[Code shown in test script]
When i simply execute this
02.75 mb
12.75 mb
22.75 mb
32.75 mb
42.75 mb
52.75 mb
62.75 mb
72.75 mb
82.75 mb
92.75 mb
102.75 mb
I have used include_once, still memory usage keeps getting up.
Steps i had taken to stop memory usage, but went in vain
1. use gc_enable
2. put unset(Variable name) above every array creation
Test script:
---------------
//Memcheck.php
<?php
for($i=0;$i<10;$i++)
{
include_once("staticarray.php");
echo "\n $i". convert(memory_get_usage(true));
}
$CITY_DROP=array();
echo "\n $i". convert(memory_get_usage(true));
function convert($size)
{
$unit=array('b','kb','mb','gb','tb','pb');
return @round($size/pow(1024,($i=floor(log($size,1024)))),2).'
'.$unit[$i];
}
?>
Expected result:
----------------
I expect memory usage should be same throughout.
02.75 mb
02.75 mb
02.75 mb
02.75 mb
02.75 mb
02.75 mb
02.75 mb
02.75 mb
02.75 mb
02.75 mb
02.75 mb
Actual result:
--------------
02.75 mb
12.75 mb
22.75 mb
32.75 mb
42.75 mb
52.75 mb
62.75 mb
72.75 mb
82.75 mb
92.75 mb
102.75 mb
--
Edit bug report at https://bugs.php.net/bug.php?id=66372&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66372&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66372&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66372&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=66372&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=66372&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=66372&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=66372&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=66372&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=66372&r=support
Expected behavior: https://bugs.php.net/fix.php?id=66372&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=66372&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=66372&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=66372&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66372&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=66372&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=66372&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=66372&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66372&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=66372&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=66372&r=mysqlcfg