|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-04-06 08:54 UTC] wez@php.net
[2001-04-06 09:19 UTC] wez@php.net
[2001-04-09 06:58 UTC] pallmall at hushmail dot com
[2001-04-09 07:29 UTC] pallmall at hushmail dot com
[2001-04-09 07:57 UTC] wez@php.net
[2001-04-09 11:22 UTC] pallmall at hushmail dot com
[2001-09-09 06:12 UTC] sterling@php.net
[2001-10-02 18:10 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 16:00:02 2025 UTC |
Try this script (tested on windows, linux and open BSD(: <?php set_time_limit(0); while (1) { unset($page); print "iteration ". ++$c; $fp = fsockopen("google.com", 80); fwrite($fp, "GET / HTTP/1.0\r\n\r\n"); while (!feof($fp)) { $page .= fgets($fp, 1000); } } ?> Run it with top or whatever running and watch the memory usage go up and up (not especially quickly because the page is small, but in certain situations I've had memory chewage of 1mb/minute). Now cf. <?php set_time_limit(0); while (1) { unset($page); print "iteration ". ++$c; $fp = fsockopen("google.com", 80); fwrite($fp, "GET / HTTP/1.0\r\n\r\n"); while (!feof($fp)) { $page .= fread($fp, 1000); } } ?> Memory usage remains constant here. [This meant I had to rewrite the readLine method in Net_Socket to use fread instead of fgets.]