On Wed, 2003-07-23 at 17:05, Aleksandr Guidrevitch wrote:
> Is there any way to completely avoid memory leackages while running 
> mod_perl ?

Don't confuse memory leakage with size increase.  Perl programs in any
environment tend to grow over time as a result of the work they are
doing.  Calling it a leak implies that the memory is somehow being lost
in a way that makes it impossible to reclaim for future use during the
life of the process.  Usually the memory is being used, not leaked.

>  Would undef'ing a variable help here ?

It could.  That would allow the memory for that variable to be used
elsewhere in your program.  It could hurt performance though if you
undef variables that you reuse frequently.  Generally you would only
want to do this with variables that might occasionally hold a large
amount of data for a short period. 

> How perl garbage 
> collector can be forced to free allocated memory ?

You can't force it.  It does try to free unused memory though.  You can
read a bit more here:
http://perlmonks.org/index.pl?node_id=267280

> I think that a little 
> overhead brought by memory allocations will save many calcs involved by 
> use MaxRequestsPerChild or size-controlling modules.

My advice to you is to write clean code and use Apache::SizeLimit.  You
will never get rid of all growth.  For one thing, there is C code used
by most people (DBI, Storable, etc.) that could also be causing growth.

- Perrin

Reply via email to