diego_de_lima has asked for the wisdom of the Perl Monks concerning the following question:
sub handler {
my $r = shift;
my $page = new Html::page;
$page->{html} = '...and here it goes...';
$page->end(); # Does some final processing
print "Content-type:...".
$page->{html};
undef $page;
}
This "end" sub is very simple, and looks like:
sub end {
my $class = shift;
$class->{html} = "Header" . $class->{html} . "Footer";
}
Apache2::Satus says itīs consumes about 27kb before serving a request. But, after being executed, it grows to the size of the HTML it processed (109kb in the example below).
Memory Usage for package Html::page Totals: 68703 bytes, 67.09 Kb, 0.07 Mb | 1284 OPs end 27748 bytes | 573 OPs new 7045 bytes | 146 OPsAnd AFTER serving a request I get:
Memory Usage for package Html::page Totals: 151779 bytes, 148.22 Kb, 0.15 Mb | 1284 OPs end 109244 bytes | 573 OPs new 7045 bytes | 146 OPsObviously the mod_perl process grows in the same rate, and it never releases memory. So I end up sometimes with process that grows from 62mb to 120mb in just one request.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Memory usage of a "sub" in mod_perl
by almut (Canon) on May 23, 2008 at 13:14 UTC | |
|
Re: Momory usage of a "sub" in mod_perl
by moritz (Cardinal) on May 23, 2008 at 13:14 UTC | |
|
Re: Memory usage of a "sub" in mod_perl
by locked_user sundialsvc4 (Abbot) on May 23, 2008 at 13:32 UTC | |
|
Re: Memory usage of a "sub" in mod_perl
by perrin (Chancellor) on May 23, 2008 at 17:07 UTC | |
by diego_de_lima (Beadle) on May 23, 2008 at 19:33 UTC | |
by shmem (Chancellor) on May 23, 2008 at 19:53 UTC | |
by diego_de_lima (Beadle) on May 23, 2008 at 20:09 UTC | |
by shmem (Chancellor) on May 23, 2008 at 20:26 UTC | |
by perrin (Chancellor) on May 23, 2008 at 20:08 UTC | |
|
Re: Memory usage of a "sub" in mod_perl
by Proclus (Beadle) on May 29, 2008 at 09:07 UTC |