ID: 32255 Updated by: [EMAIL PROTECTED] Reported By: antoine dot bajolet at tdf dot fr -Status: Open +Status: Feedback Bug Type: HTTP related Operating System: Linux 2.4.29 PHP Version: 4.3.10 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip I'm unable to replicate it. Previous Comments: ------------------------------------------------------------------------ [2005-03-09 16:16:49] antoine dot bajolet at tdf dot fr Description: ------------ It seems that there is a memory leak in fopen wrappers to HTTP. With a minimal compilation of PHP : ./configure --disable-all --enable-sockets --without-pear --enable-memory-limit --without-pcre-regex --without-mysql And the first code above, the memory used increased continuously. (the -n flag is used to ignore any php.ini script. All parameters are default). #sapi/cli/php -n script1.php 12160 13536 13672 13736 13800 13864 13928 13992 14056 14120 14184 ... still increasing With a classic fopen, works fine #sapi/cli/php -n script2.php 12128 12320 12336 12336 12336 12336 12336 12336 12336 12336 12336 ... still stable This is very annoying because we are writing a small php daemon using periodics requests on HTTP hosts. For more infos : #ldd sapi/cli/php libcrypt.so.1 => /lib/libcrypt.so.1 (0x4001b000) libresolv.so.2 => /lib/libresolv.so.2 (0x40049000) libm.so.6 => /lib/i686/libm.so.6 (0x4005b000) libdl.so.2 => /lib/libdl.so.2 (0x4007d000) libnsl.so.1 => /lib/libnsl.so.1 (0x40081000) libc.so.6 => /lib/i686/libc.so.6 (0x40096000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) /lib/libcrypt.so.1 -> libcrypt-2.3.2.so /lib/libresolv.so.2 -> libresolv-2.3.2.so Regards Antoine Bajolet Reproduce code: --------------- With this, memory problem : <?php /* script1.php */ while(true){ echo memory_get_usage()."\n"; $handler = fopen('http://some.thing/','r'); fclose($handler); sleep(2); } // while ?> With this, no memory problem <?php /* script2.php */ while(true){ echo memory_get_usage()."\n"; $handler = fopen('/etc/hosts','r'); fclose($handler); sleep(2); } // while ?> Expected result: ---------------- The memory used has to be stable, not increasing. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32255&edit=1