From:             
Operating system: Linux 2.6.29.2-smp
PHP version:      5.3.4
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:PHP does not return memory to system

Description:
------------
The script shows a huge difference in memory used by PHP and memory claimed
by the process. The memory is only returned to the system by exiting the
process.

A simple function that would return the unused memory to the kernel would
be a great solution.



Disabling gc will only make it worse.

Test script:
---------------
<?php

        gc_enable();

        for($i = 0; 1000000 > $i; $i++) {

                $x = new stdClass();

                $x->y = new stdClass();

                $x->y->x = $x;

                $x->meuk = str_repeat('x', 10000);

        }

        gc_collect_cycles();

        var_dump(memory_get_usage(false));

        var_dump(memory_get_usage(true));

?>



Expected result:
----------------
The usage numbers lying closer to eachother.

Actual result:
--------------
int(1816820)

int(25427968)

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

Reply via email to