perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donovan Allen <all...@votehere.net>
Subject Re: Out of Memory
Date Sat, 05 Jul 2003 23:22:15 GMT
>
>
>>The out of memory problem occured because i'm not using $sth->finish ?
>>    
>>
>
>Normaly this shouldn't be a problem. I guess there is somethingelse in your
>code that eats up memory...
>  
>
>>I change the parameter MaxRequestsPerChild of 0 to 100.
>>It will resolve the problem or a have to change the code of my epl files ?
>>    
>>
>
>This is a workaround, that will at least avoid the out of memory problem
>
>Gerald
>  
>
In general, all of my memory leaks with embperl have been the result of 
3rd party modules or my own modules not providing a "my" scope on 
variables.  This isn't the cause, which is infact usually something more 
silly like; $myvar .= "something more" or push @myarray,"more stuff".

Get in the habit of writing module code like this:

sub do_this {
  my ($myvar,@myarray,%myhash,$myothervar);
  # ... code ...
}

The above practice will save you from yourself.  

I have found at least 10 CPAN modules that have memory leaks due to this 
sort of thing as well.  So, you might have to isolate the leak in any 
modules you use.

The key to remember here is that the modules are stored in memory 
w/mod_perl, so properly scope ALL module variables.  Unless someone has 
used a module in a long running daemon/mod_perl code, they will likely 
never have noticed the leak.


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message