possible memory leak
From: Ian Harisay (imharisa_at_nuskin.com)
Date: 06/14/04
- Previous message: Mike Baur: "Can't download DBD-Oracle"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 14 Jun 2004 15:33:45 -0600 To: <dbi-users@perl.org>
Hi All,
I am using
Fedora Linux Core 1 and redHat 8.0
oraclie client 9.2.0.1.0
DBI 1.37
DBD::Oracle 1.15
I seem to have a memory leak problem when using bind variables and the
same prepared statement for hundreds of thousands of rows. Below is my
function call. For my test I have only one statement prepared and held
with $INS. I am inserting about 450k rows and I commit every 5000
inserts. The only thing I can think of is that my $bind_list is being
stored somewhere within the DBI or DBD::Oracle. And these values my be
getting appended to some data structure instead of clearing once I am
done with them. Anyone have any ideas?
Thanks,
Ian
sub insert {
$l->info("function ".(caller(0))[3]);
my $rec = shift; #-- the record we want to insert.
my $table = shift; #-- the name of the table we are going to insert
into
my $columns = getMetaData( $table );
my $bind_list = [];
my $col_str = join(',', @{$columns});
my $place_holders;
foreach my $column ( @{$columns} ){
push(@{$bind_list}, $rec->{$column});
$place_holders .= '?,';
}
$place_holders =~ s/,$//;
my $sql = "INSERT INTO $table ($col_str) VALUES($place_holders)";
#-- check and see if we have already prepared this statement.
unless( exists $INS->{$sql} ){
my $sth = $db->prepare($sql) || $l->logdie($db->errstr());
$INS->{$sql} = $sth;
}
$l->debug("sql: $sql");
$l->debug("bind_list: ",Dumper($bind_list));
my $rv = $INS->{$sql}->execute(@{$bind_list}) ||
$l->logdie($db->errstr());
$l->debug("rv: $rv");
}
- Previous message: Mike Baur: "Can't download DBD-Oracle"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]