Return-Path: Delivered-To: apmail-perl-modperl-archive@www.apache.org Received: (qmail 69666 invoked from network); 7 May 2007 04:17:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 May 2007 04:17:30 -0000 Received: (qmail 93925 invoked by uid 500); 7 May 2007 04:17:31 -0000 Delivered-To: apmail-perl-modperl-archive@perl.apache.org Received: (qmail 93905 invoked by uid 500); 7 May 2007 04:17:31 -0000 Mailing-List: contact modperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list modperl@perl.apache.org Received: (qmail 93894 invoked by uid 99); 7 May 2007 04:17:30 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 06 May 2007 21:17:30 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of pharkins@gmail.com designates 209.85.132.241 as permitted sender) Received: from [209.85.132.241] (HELO an-out-0708.google.com) (209.85.132.241) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 06 May 2007 21:17:23 -0700 Received: by an-out-0708.google.com with SMTP id c23so93645anc for ; Sun, 06 May 2007 21:17:03 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=p4nwgSWPfs0GsHXUfGOS/qWLjByzS35V+SqCnJebbsgmxJ6FsHHHd1keQCJVuYvHnMMSZTOoIl8x6v7Z14XgGtjLTlH6ouJ6hYkhb+b9Xqy2yfbzg5aAl+RGRUdwJWGopFhfoFSG36Svzc/n2IKe3jEoxhBX3cms0EqQXg44EhI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=KxVbOBT7slx1UmL+vexWmqyCELBD1fzECWQmCQTFbNP9P8ljBSxw+0Asjx5P9Yb7ctq5sZ3sCB4C2AP1Nc66HZ8JoDK31hAzRCpTGWp9ABAUh+cuveW4O1PxXsC/9eO/IgPgvSLt8XAbUjq3dOKdAqJ7WJi/MJdhlp7v6jnLVPo= Received: by 10.100.215.11 with SMTP id n11mr4436067ang.1178511423125; Sun, 06 May 2007 21:17:03 -0700 (PDT) Received: by 10.100.154.15 with HTTP; Sun, 6 May 2007 21:17:03 -0700 (PDT) Message-ID: <66887a3d0705062117p33d73376i8e84567e9e1c6f48@mail.gmail.com> Date: Mon, 7 May 2007 00:17:03 -0400 From: "Perrin Harkins" Sender: pharkins@gmail.com To: "James. L" Subject: Re: few newbie quesitons.. Cc: modperl@perl.apache.org In-Reply-To: <429285.85044.qm@web57911.mail.re3.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <66887a3d0705062005s66de43dbo6bc49b8580607e7f@mail.gmail.com> <429285.85044.qm@web57911.mail.re3.yahoo.com> X-Google-Sender-Auth: bad9a88a8be8282c X-Virus-Checked: Checked by ClamAV on apache.org On 5/7/07, James. L wrote: > the files i need to parse are usually in size of 2M - > 10M. will the mod_perl server(2G Mem) use up the > memory pretty quick after few hundred requests on > different files? You're misunderstanding a little bit. It's not that the memory used in parsing a file gets lost permanently. Instead, the variable that you loaded the data holds onto the memory from the largest size it got to. > sub parse { > my ($class,$file) = @_; > my @data; > open my $F, $file or die $!; > while ( my $line = <$F> ) { > my @fields = split /=/, $line; > push @data, \@fields; > } > close $F; > return \@data; > } If you read enough data into @data to use up 20MB, it will stay that size. That's a good thing if you intend to read another file of similar size on the next request. This would only be bad if you read a very large amount of data in but only now and then. The best way to avoid this kind of problem is to not read the whole thing into RAM. You can pass an iterator object to TT instead of loading all the data at once. - Perrin