php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41220 serialize takes huge amount of memory
Submitted: 2007-04-28 22:30 UTC Modified: 2007-05-08 01:00 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: shshzi at gmail dot com Assigned:
Status: No Feedback Package: Unknown/Other Function
PHP Version: 5.2.1 OS: Linux i386
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2007-04-28 22:30 UTC] 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);
?>



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-30 13:14 UTC] tony2001@php.net
Not reproducible.
 [2007-05-08 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 09:01:28 2024 UTC