Hi,

I'm writing a deamon process that has to execute a query at given
interval.
I'm using Oracle as the backend..

But my problem is that when ever the daemon wakes up, it comsumes an
addition 15 to 20 kb of memory.

I tried the same with Postgres and I found the size to reamin constant.
Is there any bug in Orcale DBI .. or is any there any way I can control
this leakage.

I'm using Perl version 5.005_03 built for i386-linux and DBI version
1.13

The code sample is below..
----------------------------
#!/usr/bin/perl

use DBI;
use POSIX qw(setsid);

my $sleeptime = 5;                 # sleep time
while(1) {
    $ENV{'ORACLE_HOME'} = '/oracle/Ora8iHome';
    my $data_source="dbi:Oracle:host=127.0.0.1;sid=test";
    my $dbh=DBI->connect($data_source,"scott","tiger") || die "Can't
connect: $DBI::errstr\n";
    my $selsql="select * from employee";
    my $sthselect=$dbh->prepare($selsql) || die "Can't prepare
statement: $DBI::errstr\n";
    $sthselect->execute() || die "Can't execute the statement:
$DBI::errstr\n";
    $sthselect->finish() || die "Can't finish the statement";
    undef $sthselect;
    $dbh->commit;
    $dbh->disconnect();
    undef $sleeptime;
    undef $dbh;
    undef $data_source;

    chdir '/' or die "Can't chdir to /: $!";
    umask 0;
    open STDIN, '/dev/null'   or die "Can't read /dev/null: $!";
#  open STDOUT, '>/dev/null' or die "Can't write to /dev/null: $!";
    open STDERR, '>/dev/null' or die "Can't write to /dev/null: $!";
    defined(my $pid = fork)   or die "Can't fork: $!";
    exit if $pid;
    setsid  or die "Can't start a new session: $!";
    sleep($sleeptime*60);
}

If any body has found the solution, please do let me know.

Thanks & Regards,
Avinash K S


Reply via email to