Bug #15485 Updated: memory ressource with socket_read()
| From: | mfischer@php.net | Date: | Sat, 08 Jun 2002 09:28:04 +0000 |
| Subject: | Bug #15485 Updated: memory ressource with socket_read() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-9827@lists.php.net to get a copy of this message | ||
ID: 15485
Updated by: mfischer@php.net
Reported By: bool@nexenservices.com
-Status: Open
+Status: Feedback
Bug Type: Sockets related
Operating System: Windows 2000 Pro
PHP Version: 4.2.0
New Comment:
Please try the latest snapshot at
http://snaps.php.net/win32/php4-win32-latest.zip
instead, this one
contains the current development code.
Previous Comments:
------------------------------------------------------------------------
[2002-06-08 05:14:32] bool@nexenservices.com
It the same things. I try now whith PHP 4.2.1
(sorry, I can't compile with the last version)
------------------------------------------------------------------------
[2002-06-07 16:47:03] sniper@php.net
reclassified where this belongs..
------------------------------------------------------------------------
[2002-06-07 14:32:00] grangeway2@hotmail.com
no output after php terminates. the script is as follows:
<?
error_reporting (E_NONE);
$socket = socket_create (AF_INET, SOCK_STREAM, SOL_TCP);
$moo = socket_connect ($socket, "www.php.net", "80");
if ($moo)
{
socket_set_nonblock ($socket);
while ($i<2000000) {
$i++;
if (($buf = socket_read($socket, 1024)) !== FALSE ) {
$buf = NULL;
unset($buf);
}
}
}
?>
(add a sleep(1) into the while loop and it's fine...)
------------------------------------------------------------------------
[2002-06-07 13:52:09] mfischer@php.net
Please test against http://snaps.php.net/php4-latest.tar.gz, compile
with --enable-debug and if the extension really leaks memory please
paste the output after php ends (you will get a leak list [kind of] if
there's really a leak).
------------------------------------------------------------------------
[2002-06-07 13:47:06] grangeway2@hotmail.com
socket_set_nonblock ($socket);
while (1) {
sleep(1);
if (($buf = socket_read($socket, 1024)) !== FALSE ) {
$buf = NULL;
unset($buf);
}
}
--> that code works fine.
As the original reporter says, if you remove sleep(1) it leaks memory.
Approximately 1Mb of memory every few seoncds here.
This is against 4.2.1
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/15485
--
Edit this bug report at http://bugs.php.net/?id=15485&edit=1