Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60425 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82329 invoked from network); 3 May 2012 03:13:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 May 2012 03:13:24 -0000 Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 66.111.4.28 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 66.111.4.28 out4-smtp.messagingengine.com Received: from [66.111.4.28] ([66.111.4.28:39187] helo=out4-smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C8/8C-10491-2D7F1AF4 for ; Wed, 02 May 2012 23:13:22 -0400 Received: from compute4.internal (compute4.nyi.mail.srv.osa [10.202.2.44]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 5675421263 for ; Wed, 2 May 2012 23:13:19 -0400 (EDT) Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161]) by compute4.internal (MEProxy); Wed, 02 May 2012 23:13:19 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:date:from:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; s=smtpout; bh=yWHdvnHZQmhKaIXEBUmMnG 5u2qQ=; b=lHeb1ZYlPfuebfcjGRwVXlFeOgqO32VE/PeKuTv0UpvveA9BjC1Sid umBRwkMIwrDWyNf18pq830gBRJ0h5tcu9hc9gcMxyYOVZdKa2P6fFWzXJZmpXgmb qMRdivagvFbdDvptdA5mq4CuTo/1phLuMul7DniMKHr8jmRyK2hlM= X-Sasl-enc: L+D7mc4aWI8iL0xiwMdrvH4lRHzRlpJZduDPgWz2atBc 1336014799 Received: from [192.168.42.21] (c-98-220-238-115.hsd1.il.comcast.net [98.220.238.115]) by mail.messagingengine.com (Postfix) with ESMTPSA id 18EC5482478 for ; Wed, 2 May 2012 23:13:19 -0400 (EDT) Message-ID: <4FA1F7CE.1090409@garfieldtech.com> Date: Wed, 02 May 2012 22:13:18 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: internals@lists.php.net References: <4F9E2173.50005@garfieldtech.com> <000e01cd269a$06f15230$14d3f690$@php.net> <002701cd26b5$1cd0bb70$56723250$@thetaphi.de> <4F9EC8B4.3040600@garfieldtech.com> <4F9F4208.7020106@garfieldtech.com> <4FA01214.5030606@garfieldtech.com> In-Reply-To: <4FA01214.5030606@garfieldtech.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] readfile() memory usage From: larry@garfieldtech.com (Larry Garfield) On 05/01/2012 11:40 AM, Larry Garfield wrote: > On 5/1/12 10:01 AM, Paul Reinheimer wrote: >> Hi All, >> >>> Unfortunately, you've ignored Uwe's e-mail... The problem is not the >>> PHP >>> version; the problem is that you're buffering unlimited amounts of >>> data. >>> Check your configuration and make sure ob_get_level() returns 0. >> >> My apologies in the delay, ob_get_level() returns 1, good catch. >> phpinfo() reports output_buffering as 4096 >> >> >> Does this push what I'm getting into expected behaviour? >> >> >> paul > > It sounds like it. In that case the memory spike is happening in the > output buffer, where the file is streamed into by readfile() in 8K > chunks until the output buffer explodes. :-) > > So, I think we're back to "urban legend" territory. > > --Larry Garfield > Thanks for the sanity check, everyone. I've put together a blog post with my findings. If anyone wants to check it to make sure I am not saying anything grotesquely wrong before I posted it, that would be much appreciated. :-) It's set to world-commentable: https://docs.google.com/document/d/1qfe4OUc5lbuoSZFUh6NZYP-6pbaiquxnOFwN_oBccBI/edit --Larry Garfield