From:             
Operating system: Windows XP SP3 32bit
PHP version:      5.3.8
Package:          Program Execution
Bug Type:         Bug
Bug description:64kB memory leak in exec() and related functions

Description:
------------
For each call to exec(), system(), popen() oder proc_open(), Windows will
show 
an 
increase of 64kB in total commited memory. Those 64kB don't add to the
memory 
commited by PHP and Windows won't free the memory when the php process 
terminates.  
The memory will only be freed, when the user closes the windows session.

Repeated calls (depending on your system memory somewhere around 10-50.000

calls) 
to those functions will render the system unable to start new threads and
cause 
the windows kernel to force a reboot. This was confirmed on 3 independent 
machines.

This problem occures both in cli mode and with mod_php as Apache module.
This 
problems even occurs when proc_open is used with the "bypass_shell"
option.

The problem appears similiar to #42602, but every other script engine does
just 
fine on this machine, so it must somehow be related to the way php starts 
processes in Windows.

Test script:
---------------
<?php
// 1000 calls = 1000 * 64kB = 64MB memory leak
for($i = 0; $i < 1000; $i++) {
        exec("who"); // Or any other command of your choice
        if($i%100 == 0) {
                // Shows constant amount
                echo memory_get_usage()."\r\n";
                // Also constant
                echo memory_get_usage(true)."\r\n";
        }
}

Expected result:
----------------
The amount commited memory of the system should go back to normal when the
php 
process amd all started child processes terminate.

Actual result:
--------------
For each call of exec(), additional 64kB of memory will be commited,
allthough 
windows claims that this memory is not assigned to any process. This memory
will 
only be freed, when the windows session is closed.

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

Reply via email to