Bug #60256 [Opn->Fbk]: 64kB memory leak in exec() and related functions
| From: | cataphract@php.net | Date: | Fri, 11 Nov 2011 00:51:01 +0000 |
| Subject: | Bug #60256 [Opn->Fbk]: 64kB memory leak in exec() and related functions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-165026@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60256&edit=1
ID: 60256
Updated by: cataphract@php.net
Reported by: andreas dot ringlstetter at gmail dot com
Summary: 64kB memory leak in exec() and related functions
-Status: Open
+Status: Feedback
Type: Bug
Package: Program Execution
Operating System: Windows XP SP3 32bit
PHP Version: 5.3.8
Block user comment: N
Private report: N
New Comment:
I can't reproduce in Windows 7 64-bit (32-bit binaries). Are you able to test this on this OS?
Previous Comments:
------------------------------------------------------------------------
[2011-11-10 13:42:12] andreas dot ringlstetter at gmail dot com
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 this bug report at https://bugs.php.net/bug.php?id=60256&edit=1