mmap in php_passthru_fd in file.c ?
| From: | Rasmus Lerdorf | Date: | Fri, 18 May 2001 04:43:50 +0000 |
| Subject: | mmap in php_passthru_fd in file.c ? | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-55693@lists.php.net to get a copy of this message | ||
If a system has mmap() a readfile() will mmap the entire file to memory
and then dump that while without mmap it will read it one block at a time.
That's a siginificant memory difference and one that may not be expected.
Obviously the mmap will be faster, but if as in bug #10701, someone is
adding headers or doing something else to really large files, things are
going to break. Since readfile() already has an opotional argument I
think the right approach is a separate function that turns the mmap off
and reads the file block by block. fpassthru() doesn't have an optional
arg, so we could toggle it there for that function.
Comments?
-Rasmus