i still have few questions, would you please answer
them for me? see below..

--- Perrin Harkins <[EMAIL PROTECTED]> wrote:

> On 5/7/07, James. L <[EMAIL PROTECTED]> 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.

here is my understand and please verify.

say i have sub parse { return
$array_ref_contain_the_data } 

does that memory used by the
$array_ref_contain_the_data can be reused by other
mod_perl application too? or it is used only by the
particular $array_ref_contain_the_data? 


> > sub parse {
> >   my ($class,$file) = @_;
> >   my @data;
> >   open my $F, $file or die $!;
> >   while ( my $line = <$F> ) {
> >     my @fields = split /=/, $line;
> >     push @data, [EMAIL PROTECTED];
> >   }
> >   close $F;
> >   return [EMAIL PROTECTED];
> > }
> 
> 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.

even if i am using an iterator object and call it.next
in TT, doesn't TT actually keep the rendered template
page into one variable and dump it to the browser? in
that case, the memory consumed is still equal to the
entire size of the data and iterator doesn't help
here. am i right?
 
> - Perrin
> 

James.


       
____________________________________________________________________________________Give
 spam the boot. Take control with tough spam protection in the all-new Yahoo! 
Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/newmail_html.html 

Reply via email to