--- Perrin Harkins <[EMAIL PROTECTED]> wrote:
> On 5/6/07, James. L <[EMAIL PROTECTED]> wrote:
> > my question is
> > once the app produce the html, does the memory
> > allocated by the parsed data get released to perl?
> > that memory will be reused by other mod_perl app?
>
> No, Perl doesn't work that way. It will keep that
> memory allocated
> for that variable unless you undef the variable
> explicitly.
>
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?
the app currently run under plain cgi. i am using
CGI::Application. the simplified code as following:
package My::App;
sub table {
my $data_ref = My::Parser->parse( $file_to_parse );
return $tt->process('table.tt', { data => $data } );
}
#####
package My::Parser;
....
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];
}
i think i need to re-read CGI to mod_perl Porting doc.
in some case, i still unsure if the variable is gone
as i think it is.
> > in the config module example from mod_perl doc, it
> > says that declaring a global hash which consists
> the
> > configs is better than declaring few global
> variables.
> > why is that? i thought that they takes the same
> amount
> > of memory..
>
> Without seeing the documentation you're referring
> to, we can only
> guess why it says that. It wouldn't be to save
> memory. Maybe it's to
> avoid namespace pollution or to make importing easy.
>
never mind. i read the doc wrong.
[snip]
> - Perrin
>
thanks,
James.
____________________________________________________________________________________
It's here! Your new message!
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/