From: info at pion dot xs4all dot nl Operating system: Linux PHP version: Irrelevant PHP Bug Type: *Directory/Filesystem functions Bug description: Huge memory usage in file copy of big files
Description: ------------ If you copy a file of N megabytes (N in the order of a few hundred megs) your proces will use the same order of ammount of memory (or less if the system doesn't have that much). This is probably because the file is compleetly memory mapped and than the content is written to an other file. Probably it will be better to use the behavior of the unix "cp" command which reads 4k and than writes the 4k. In this way "cp" is almost a factor two faster than php and has less impact on the system performance. Reproduce code: --------------- <?php # # This assumes that there excist a big # file "/tmp/file_512m" which has 512mb # of data and that there is enough space # in "/tmp". # copy ("/tmp/file_512m", "/tmp/target") ?> Expected result: ---------------- The unix "cp" needed 1 minut 8 seconds to copy the file and php used 2 and 18 seconds on my desktop system with 512mb. Actual result: -------------- They should be in the same order -- Edit bug report at http://bugs.php.net/?id=29922&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29922&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=29922&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=29922&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=29922&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=29922&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=29922&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=29922&r=needscript Try newer version: http://bugs.php.net/fix.php?id=29922&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=29922&r=support Expected behavior: http://bugs.php.net/fix.php?id=29922&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=29922&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=29922&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=29922&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29922&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=29922&r=dst IIS Stability: http://bugs.php.net/fix.php?id=29922&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=29922&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=29922&r=float