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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
14 + 43 = ?
Subscribe to this entry?

 
 [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-2022 The PHP Group
All rights reserved.
Last updated: Wed Sep 28 22:04:50 2022 UTC