perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Gormley <cl...@traveljury.com>
Subject Re: huge httpd processes
Date Tue, 29 Sep 2009 22:16:56 GMT

> 
> I tried undef'ing @data just before the return as it is no longer used
> but 
> this only gained me 1/2 Mb. I would have expected to get all 8Mbs
> back. I 
> don't understand why not.
> 
Perl (as least on the OS's that I'm familiar with) doesn't release used
memory back to the OS.

Have a look at:
 - http://www.perlmonks.org/?node_id=333464
 - http://www.perlmonks.com/index.pl?node_id=126591

for more discussion on the matter.

But basically, try to avoid loading all that data in your mod_perl
process.
> 
> Also - in general terms if you do something like this (simplified):
> 

> our $var;
> sub new() {
> $var = "hello world";
> }
> 
> 
> \Since the module containing the package MyClass is loaded into the 
> apache/mod_perl process does $var ever go out of scope once set? I
> think 
> not - and it's memory is never freed? if this is correct and I used
> my 
> instead even then would it go out scope ?

It wouldn't go out of scope because it's scope continues to exist until
exit.

There are good reasons for using variables at package level, but don't
use them if you don't have to.

clint


Mime
View raw message