The script is not smallish, but the main loop looks like this:
{
# Connecting
$dbh = new Sybase::DBlib $userid, $password, $host;
$dbh->dbuse($database);
# Checking
checkProsesses();
checkSegmentStatus();
getMonitor();
# Disconnecting
$dbh->dbclose;
}
Rune
----- Original Message -----
From: "Jonathan E. Paton" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 02, 2002 12:15 PM
Subject: Re: SybPerl - Memory leaks
> > I've created a script that is checking the status of an ASE-server.
> > It's running in an infinitive loop:
> >
> > 1. Connect to the database
> > 2. Doing some checks...
> > 3. Disconnecting from the db
> > 4. Sleeping for avile
> > 5. <Doing all again (goto 1)>
> >
> > I found that the perl prosess is using about 4k more memory for each
> > time it runs the loop. If the script runs once on hour it will use
> > about 3000k more memory after one month... The script is supposed to
> > run longer than that...
>
> This sounds like a memory leak of some sort, and you post your script
> (if it's smallish) so that we can take a peek? The main loop should
> look something like:
>
> while (1) {
> $dbh = Connect->new(); # psuedocode
> verify($dbh);
> $dbh->disconnect();
> sleep $time;
> }
>
> and use lexical variables in 'verify()', hence you avoid leaving large
> datastructures in memory when you sleep.
>
> > I'm using SybPerl to connect to the database. What can I do to avoid
> > the memory leak?
>
> If it still leaks after checking your code, then update the module. Try
> again, and if there is still a problem then simplify the script until it
> goes away. Then create a bug report with 'rt.cpan.org', giving the script
> that demonstrates the problem (the reduced one).
>
> Jonathan Paton
>
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]