#41220 [Opn->Fbk]: serialize takes huge amount of memory
| From: | tony2001@php.net | Date: | Mon, 30 Apr 2007 13:14:50 +0000 |
| Subject: | #41220 [Opn->Fbk]: serialize takes huge amount of memory | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-112095@lists.php.net to get a copy of this message | ||
ID: 41220
Updated by: tony2001@php.net
Reported By: shshzi at gmail dot com
-Status: Open
+Status: Feedback
-Bug Type: Reproducible crash
+Bug Type: Unknown/Other Function
Operating System: Linux i386
PHP Version: 5.2.1
New Comment:
Not reproducible.
Previous Comments:
------------------------------------------------------------------------
[2007-04-28 22:30:41] shshzi at gmail dot com
Description:
------------
when using serialize on some large (not huge) array, it will take
insane
amounts of memory.
look at the code , when using size array of 30,000 , the script works
as expected, indicating that the output is a mere 2MB in length,
while enlarging the array to 50,000 elements causes php to go crazy
and
hit the 600MB i've allowed him to consume...
Reproduce code:
---------------
<?
$a = array();
for($i=0;$i<50000;$i++)
{
$a[$i] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
}
$z = serialize($a);
print strlen($z);
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41220&edit=1