Re: readfile() memory usage

From: Date: Tue, 01 May 2012 01:53:12 +0000
Subject: Re: readfile() memory usage
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-60383@lists.php.net to get a copy of this message
On 04/30/2012 07:37 PM, Paul Reinheimer wrote:
Hi Larry,
4) So given #2 and #3, the "readfile() will kill your memory, don't use it" line is a persistent urban legend that belongs on Snopes as debunked. Looping on fread() for performance is a red herring.
I implemented this earlier this very year to avoid memory issues (a quick look at project history shows me working on it in January). The difference between using readfile, and some convoluted method from the documentation comments was clear and immediate: corrupted download with out of memory error in the logs, to things working just fine. Let me re-create with a simple test script and share my server details before we call snopes :)
Fascinating. I even verified the md5sum of the file I got on the other end just to be sure. I'll hold off on the blog post then. :-) I look forward to your test setup. --Larry Garfield

« previous php.internals (#60383) next »