#33127 [Opn]: fsockopen memory leak
| From: | joropito at ciudad dot com dot ar | Date: | Tue, 24 May 2005 14:50:52 +0000 |
| Subject: | #33127 [Opn]: fsockopen memory leak | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-79445@lists.php.net to get a copy of this message | ||
ID: 33127
User updated by: joropito at ciudad dot com dot ar
Reported By: joropito at ciudad dot com dot ar
Status: Open
Bug Type: Sockets related
Operating System: FreeBSD 5.3/4
PHP Version: 5.0.4
New Comment:
Reproducible under php-4.3.9
Smaller reproducible code
<?php
system("/bin/ps -l -p ".posix_getpid());
$fd = fsockopen("www.yahoo.com", 80, $errno, $errstr, 3);
system("/bin/ps -l -p ".posix_getpid());
if($fd) fclose($fd);
system("/bin/ps -l -p ".posix_getpid());
?>
Previous Comments:
------------------------------------------------------------------------
[2005-05-24 16:43:21] joropito at ciudad dot com dot ar
Description:
------------
I see that fsockopen() causes a memory leak although of closing
filedescriptor.
Reproduce code:
---------------
system("/bin/ps -maxwvj -p ".posix_getpid());
$fd = fsockopen("www.yahoo.com", 80, $errno, $errstr, 3);
system("/bin/ps -maxwvj -p ".posix_getpid());
if($fd) {
$out = "GET / HTTP/1.1\nHost: www.yahoo.comConnection: Close\n\n";
fwrite($fd, $out);
$line = "";
while (!feof ($fd)) {
$lastline = fgets($fd);
$line .= $lastline;
if(ereg("Content-Type: text/html", $lastline)) { break; }
}
fclose($fd);
echo $line;
}
system("/bin/ps -maxwvj -p ".posix_getpid());
sleep(5);
Expected result:
----------------
You will see after issue fsockopen() memory usage rises, and if you
issue fclose() does not free memory.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33127&edit=1