AIX 4.3, Perl 5.8.0, DBI 1.30, DBD-Oracle 1.12, Oracle 8.1.7

Inserting or updating a LOB column seems to leak memory every 
time the statement handle is destroyed.  When the statement handle 
is reused by prepare()ing outside the loop or different column is
used instead, the memory footprint remains constant.

Am I doing something wrong?

For example (from memory);
---------------------- cut here ------------------------
CREATE TABLE TESTLOB (
        ID      NUMBER(12),
        BODY    CLOB,
        MSG     VARCHAR2(128)
);
---------------------- cut here ------------------------
use DBI         qw(:sql_types);
use DBI::Oracle qw(:ora_types);

my $dbh = DBI->connect("dbi:Oracle:host=localhost;instance=ORCL",
'test', 'test');
$dbh->{'RaiseError'}  = 1;
$dbh->{'LongTruncOk'} = 0;
$dbh->{'LongReadLen'} = 1*1024*1024;
$dbh->{'AutoCommit'}  = 0;

my $id   = 1;
my $body = 'x' x 5000;
my $sth;
# $sth = $dbh->prepare('INSERT INTO TESTLOB (BODY, ID) VALUES (?, ?)');
# $sth = $dbh->prepare('UPDATE TESTLOB SET BODY = ? WHERE ID = ?');
for (my $updated = 0; $updated < 10000; $updated++) {
  $sth = $dbh->prepare('INSERT INTO TESTLOB (BODY, ID) VALUES (?, ?)');
  # $sth = $dbh->prepare('UPDATE TESTLOB SET BODY = ? WHERE ID = ?');

  $sth->bind_param(1, $body, {ora_type => ORA_CLOB, ora_field =>
'BODY'});
  $sth->bind_param(2, $id, SQL_INTEGER);
  $sth->execute;
  $sth->rollback;
}
$dbi->disconnect;
exit;

Reply via email to