ID:               34471
 Updated by:       [EMAIL PROTECTED]
 Reported By:      wojtek at wojjie dot com
-Status:           Open
+Status:           Wont fix
 Bug Type:         Performance problem
 Operating System: Gentoo/Fedora
 PHP Version:      5.0.5
 New Comment:

That's the way fread() works.
Use stream_get_contents() instead.


Previous Comments:
------------------------------------------------------------------------

[2005-09-12 03:03:14] wojtek at wojjie dot com

Description:
------------
fread() seems to allocate length amount of memory for getting data from
the connection, but does not release it till you do something to
variable. If $dat did have data, and you did:

$dat=$dat.'';

It would then release any unused memory. 

Not sure if this is a bug, but I thought I would submit it incase.


Reproduce code:
---------------
<?php
$fp=fsockopen('udp://192.168.0.1', 27015, $errno, $errstr);
stream_set_blocking($fp, false);
$dat=fread($fp, 4096000);
fclose($fp);
$bmem=memory_get_usage();
echo strlen($dat)."\n";
unset($dat);
echo (memory_get_usage()-$bmem)."\n";

?>


Expected result:
----------------
Difference in memory usage should not be so huge as 4095896 bytes.



Actual result:
--------------
-4095896



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=34471&edit=1

Reply via email to