Bug #66372 [Opn->Fbk]: Garbage collection issue
| From: | krakjoe@php.net | Date: | Wed, 01 Jan 2014 08:36:12 +0000 |
| Subject: | Bug #66372 [Opn->Fbk]: Garbage collection issue | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-183523@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66372&edit=1
ID: 66372
Updated by: krakjoe@php.net
Reported by: nikcomestotalk at gmail dot com
Summary: Garbage collection issue
-Status: Open
+Status: Feedback
Type: Bug
Package: *General Issues
Operating System: Linux
PHP Version: 5.4.23
Block user comment: N
Private report: N
New Comment:
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.
We require the inclusion of (by means of a link to some online hosting service for text files, ie
git/pastebin etc) code that reproduces the error you experience.
We have no way to guess the content of staticarray.php, and 3 arrays is not enough, obviously. If
you are not able to include some data then generate some that exhibits the same symptoms, but
generate it in such a way that it's as close to your use case as possible.
Previous Comments:
------------------------------------------------------------------------
[2013-12-31 08:42:42] nikcomestotalk at gmail dot com
testscript has already been added Memcheck.php
staticarray.php[Data is too huge, so adding few arrays to script][And i can't share the real
data, some legal issues]
<?php
$siteType=array("API","MOBILE","WEB","ANDROIDAPP","IOSAPP");
$siteServer=array("127.0.0.1","127.0.0.2","127.0.0.3","127.0.0.4");
$country=array("INDIA","AUSTRALIA","UK","USA","CHINA","JAPAN");
?>
------------------------------------------------------------------------
[2013-12-31 08:24:36] krakjoe@php.net
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.
------------------------------------------------------------------------
[2013-12-31 07:35:50] nikcomestotalk at gmail dot com
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 this bug report at https://bugs.php.net/bug.php?id=66372&edit=1