fread is allocating memory on its own?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm trying to use a PHP script to test the throughput from a few different web servers on a test network at work. I'm doing an fopen with the URL, and then a read loop like this:

while (!feof($handle)) {
	fread($handle, 8192);
}

I'm ignoring the data returned by fread, since I'm just interested in how long that loop takes, not the contents. It works fine on small files, but once the test file is above PHP's memory limit I get "Allowed memory size of 8388608 bytes exhausted (tried to allocate 8192 bytes)".

What I can't figure out is why memory is getting allocated in that loop.

I've also tried doing $string = fread (...) and immediately following that with unset($string) or $string = NULL or $string = ''. None of those worked, I still run out of memory.

Any suggestions?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux