Edit report at http://bugs.php.net/bug.php?id=51155&edit=1
ID: 51155
Updated by: colder@php.net
Reported by: flavius dot as at gmail dot com
-Summary: serialize() crashes with unreasonable/unexplicable
"out of memory" for objects
+Summary: Unreasonable non-emalloc allocations of memory
Status: Open
Type: Bug
-Package: SPL related
+Package: Scripting Engine problem
Operating System: ArchLinux x86_64
PHP Version: 5.3.2
New Comment:
This is not related to SPL nor to serialize.
In fact, it's simply that your functions make PHP allocate a lot of
memory on the
side (not using emalloc). Try with memory_get_usage(true); you'll see
that you hit
already ~128M before even serializing,
This is a bit smaller using a normal array, so it's not really related
to
SplFixedArray.
Previous Comments:
------------------------------------------------------------------------
[2010-03-27 14:45:00] flavius dot as at gmail dot com
updated version
------------------------------------------------------------------------
[2010-03-04 15:10:04] flavius dot as at gmail dot com
Ok, I've managed to compile and test with php5.3-201003041130, the bug
is still there, but it seems to crash for higher values.
for 20000 items, the peak is
peak 21.71 mb before serialize,
peak 45.59 mb after serialize. simple maths: it should need
approximatively 5 mb for every 5000 items.
The following test run for 25000 confirms my theory (roughly, +/- due to
temporarily saving the return value, runtime memory, etc):
before serialization: peak 26.98 mb
after: peak 56.7 mb
Ok, it's slightly higher than 5mb, after serialization is a small
increase over the expected (which I presumed) 2*n linear growth.
Now the final run. But first and foremost
$ sapi/cli/php -i |grep memory
memory_limit => 128M => 128M
And the test run, for 30000 items:
GENERATING DONE
peak 32.24 mb
---
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to
allocate 28574231 bytes)
The expected value was somewhere around (and I'll be generous) 80mb. But
I suppose it still has that spark of exponential growth somewhere
between 25000 and 30000 items.
------------------------------------------------------------------------
[2010-03-04 14:30:17] pajoye@php.net
That's unrelated to this bug, disable imap to test a new build.
However, about this error, get a decent c-client and it will work (like
less than 4-5 years old).
------------------------------------------------------------------------
[2010-03-04 14:26:28] flavius dot as at gmail dot com
Using it gives the configure error:
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL
is missing. This should not happen. Check config.log for additional
information.
------------------------------------------------------------------------
[2010-03-01 17:02:22] jani@php.net
Please try using this snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/bug.php?id=51155
--
Edit this bug report at http://bugs.php.net/bug.php?id=51155&edit=1