Edit report at http://bugs.php.net/bug.php?id=51155&edit=1

 ID:               51155
 User updated by:  flavius dot as at gmail dot com
 Reported by:      flavius dot as at gmail dot com
 Summary:          serialize() crashes with unreasonable/unexplicable
                   "out of memory" for objects
-Status:           Feedback
+Status:           Open
 Type:             Bug
 Package:          SPL related
 Operating System: ArchLinux x86_64
-PHP Version:      5.3.1
+PHP Version:      5.3.2

 New Comment:

updated version


Previous Comments:
------------------------------------------------------------------------
[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] paj...@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] j...@php.net

Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/



------------------------------------------------------------------------
[2010-02-26 13:41:59] flavius dot as at gmail dot com

Oh and I've forgot to mention, there's plenty of RAM and swap space
before running php -f:



free -m

             total       used       free     shared    buffers    
cached

Mem:          1975       1732        243          0        131      
1027

-/+ buffers/cache:        573       1402

Swap:         5718          0       5718

------------------------------------------------------------------------


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

Reply via email to