From:             
Operating system: Debian Linux
PHP version:      5.4SVN-2012-02-08 (snap)
Package:          Performance problem
Bug Type:         Bug
Bug description:Memory leak on unserialize for certain nested objects

Description:
------------
Unserializing certain objects on a loop, incurs in increased memory
consumption 
even when the garbage collector is enables and gc_collect_cycles() is
called 
after each iteration.  

For the test script there is an increase of almost 5MB, after 100 runs, it

doesn't happen with every object, but it does with the one on the test. 
The increase is not with every iteration but every couple of iterations,
until it 
reaches a maximum, in this case the 4980736 bytes.

This report is related to bug #60937, I had no reply on my comments.
Thanks,

Test script:
---------------
The test script can be found at:
http://dl.dropbox.com/u/7170408/unserialize_memleak.php

Expected result:
----------------
Consistent memory usage.

Actual result:
--------------
The output of the script:

Iteration 0      Start Mem 786432 Cicle Mem 3145728 Diff 2359296
Iteration 1      Start Mem 786432 Cicle Mem 5505024 Diff 4718592
Iteration 2      Start Mem 786432 Cicle Mem 5505024 Diff 4718592
Iteration 3      Start Mem 786432 Cicle Mem 5505024 Diff 4718592
Iteration 4      Start Mem 786432 Cicle Mem 5505024 Diff 4718592
Iteration 5      Start Mem 786432 Cicle Mem 5505024 Diff 4718592
Iteration 6      Start Mem 786432 Cicle Mem 5505024 Diff 4718592
Iteration 7      Start Mem 786432 Cicle Mem 5505024 Diff 4718592
Iteration 8      Start Mem 786432 Cicle Mem 5505024 Diff 4718592
Iteration 9      Start Mem 786432 Cicle Mem 5505024 Diff 4718592
Iteration 10     Start Mem 786432 Cicle Mem 5505024 Diff 4718592
Iteration 11     Start Mem 786432 Cicle Mem 5505024 Diff 4718592
Iteration 12     Start Mem 786432 Cicle Mem 5505024 Diff 4718592
Iteration 13     Start Mem 786432 Cicle Mem 5505024 Diff 4718592
Iteration 14     Start Mem 786432 Cicle Mem 5505024 Diff 4718592
Iteration 15     Start Mem 786432 Cicle Mem 5505024 Diff 4718592
Iteration 16     Start Mem 786432 Cicle Mem 5505024 Diff 4718592
Iteration 17     Start Mem 786432 Cicle Mem 5505024 Diff 4718592
Iteration 18     Start Mem 786432 Cicle Mem 5505024 Diff 4718592
Iteration 19     Start Mem 786432 Cicle Mem 5505024 Diff 4718592
Iteration 20     Start Mem 786432 Cicle Mem 5505024 Diff 4718592
Iteration 21     Start Mem 786432 Cicle Mem 5505024 Diff 4718592
Iteration 22     Start Mem 786432 Cicle Mem 5505024 Diff 4718592
Iteration 23     Start Mem 786432 Cicle Mem 5505024 Diff 4718592
Iteration 24     Start Mem 786432 Cicle Mem 5505024 Diff 4718592
Iteration 25     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 26     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 27     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 28     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 29     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 30     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 31     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 32     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 33     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 34     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 35     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 36     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 37     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 38     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 39     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 40     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 41     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 42     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 43     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 44     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 45     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 46     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 47     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 48     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 49     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 50     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 51     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 52     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 53     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 54     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 55     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 56     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 57     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 58     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 59     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 60     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 61     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 62     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 63     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 64     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 65     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 66     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 67     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 68     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 69     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 70     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 71     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 72     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 73     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 74     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 75     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 76     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 77     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 78     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 79     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 80     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 81     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 82     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 83     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 84     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 85     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 86     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 87     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 88     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 89     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 90     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 91     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 92     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 93     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 94     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 95     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 96     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 97     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 98     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Iteration 99     Start Mem 786432 Cicle Mem 5767168 Diff 4980736
Done.

Start Mem 786432 End Mem 5767168 Final Diff 4980736

-- 
Edit bug report at https://bugs.php.net/bug.php?id=61014&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=61014&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=61014&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=61014&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=61014&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=61014&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=61014&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=61014&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=61014&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=61014&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=61014&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=61014&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=61014&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=61014&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=61014&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=61014&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=61014&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=61014&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=61014&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=61014&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=61014&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=61014&r=mysqlcfg

Reply via email to