tyric has asked for the wisdom of the Perl Monks concerning the following question:
I'm working on a perpetual program. It runs indefinitly, checking on various servers using ping or SNMP queries. It works like I want it to but it has one major problem. It continualy grabs and uses more ram and process time with each iteration, growing until it become a detriment to the system it's running on.
I have a secondary script, an outside file, that I open and eval. Would this be bloating the memory? This file is simply a hash of data that may change while the script is running. I've set the program up, so that the data can be changed while the script is running.
Here's an example of the data it's calling.open(DATA,"data.pl"); while (<DATA>) {$data .= $_;} close DATA; eval $data;
@array = ( { label => "backup.hostname.com", status => "on", type => "ping", data => "hostname.com", user => user@hostname.com, error => 'Failed', }, );
But i digress, what I'm looking for is some tutorials on memory management. Where can I find this information, and how can I trim a bloated program while it is running. Similar to undef, but will actually free the memory up for the system.
tyric
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Memory Management in Perl
by dws (Chancellor) on Feb 16, 2002 at 04:25 UTC | |
|
Re: Memory Management in Perl
by dash2 (Hermit) on Feb 16, 2002 at 11:09 UTC | |
|
Re: Memory Management in Perl
by steves (Curate) on Feb 16, 2002 at 04:49 UTC | |
|
Re: Memory Management in Perl
by dash2 (Hermit) on Feb 16, 2002 at 11:11 UTC | |
by tyric (Novice) on Feb 21, 2002 at 02:56 UTC | |
|
Re: Memory Management in Perl
by thor (Priest) on Feb 16, 2002 at 13:21 UTC | |
|
Quickie memory leak fix
by kjherron (Pilgrim) on Feb 16, 2002 at 16:52 UTC |