On Sun, 19 Jun 2005, Siegfried Heintze wrote:

> I have to restart the program frequently.
 
That line right there screams "fork & exec". 

That's how Apache does it: one master process spawns a series of slave 
processes that handle requests, and just in case any of them are going 
haywire with memory leaks, they get automatically expired after they've 
been around for a while. On platforms where spawning new processes is a 
cheap operation (e.g. Linux) this can be very efficient; where spawning 
processes is expensive (e.g. Windows), it doesn't perform quite as well, 
but it's still a pretty good approach to the problem.

Alternatively, deleting the hash *keys* may do no good, but you may be 
able to make some headway by deleting the entire hash itself. This may 
work better, but it's probably easier all around to just fork off child 
processes and resign yourself to caching state information somewhere, 
either in a database, a flat file, or even just a Data::Dumper dump.

 

-- 
Chris Devers

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to