Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60384 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45820 invoked from network); 1 May 2012 08:43:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 May 2012 08:43:42 -0000 Authentication-Results: pb1.pair.com header.from=thetaphi@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=thetaphi@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 188.138.97.18 as permitted sender) X-PHP-List-Original-Sender: thetaphi@php.net X-Host-Fingerprint: 188.138.97.18 serv1.sd-datasolutions.de Linux 2.6 Received: from [188.138.97.18] ([188.138.97.18:51283] helo=mail.sd-datasolutions.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 67/80-38165-D32AF9F4 for ; Tue, 01 May 2012 04:43:42 -0400 Received: from VEGA (port-92-196-65-14.dynamic.qsc.de [92.196.65.14]) by mail.sd-datasolutions.de (Postfix) with ESMTPSA id 0D19114AA006; Tue, 1 May 2012 08:43:38 +0000 (UTC) To: "'Paul Reinheimer'" , Cc: "'Larry Garfield'" References: <4F9E2173.50005@garfieldtech.com> <000e01cd269a$06f15230$14d3f690$@php.net> <002701cd26b5$1cd0bb70$56723250$@thetaphi.de> <4F9EC8B4.3040600@garfieldtech.com> In-Reply-To: Date: Tue, 1 May 2012 10:44:01 +0200 Message-ID: <00d901cd2776$8ef27150$acd753f0$@php.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQHSGBh16tjoKJ9vPkoJpKVM1exOXAG6vPgfAvqifT4CST78sAKyKnrWArKfqW8CJdt2QpY2crtA Content-Language: de Subject: RE: [PHP-DEV] readfile() memory usage From: thetaphi@php.net ("Uwe Schindler") > 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 :) Are you sure that you are *not* using ob_start()/ob_flush()/... (output buffering)? If this is the case, readfile writes to the output, but buffers everything in memory, as the PHP output buffering is active? Uwe