Hi,
I'm currently working on a test/demo using perl and DBI. I have
encountered some memory problems with DBD:Oracle (I don't have them with
DBD:mysql). My test program has no memory leak from his own. I'm sure.
I give you two pieces of code. They "eat" continuously my precious
memory.
1- connection/deconnection loop
##############################################
#!/usr/bin/perl
use DBI;
for (;;) {
$dbh=DBI->connect('dbi:Oracle:', "scott/tiger\@host");
print STDERR ".";
$dbh->disconnect;
}
###############################################
This simple code take a little bit of memory (about 60kb for 900 cx/dx
cycles). It's quite annoying but nothing compared to...
2- do statements (really greedy)
###############################################
#!/usr/bin/perl
use DBI;
$dbh=DBI->connect('dbi:Oracle:', "scott/tiger\@host");
$dbh->{AutoCommit} = 0;
$dbh->{RowCacheSize} = 1;
$dbh->do("create table T (i int not null,p int not null,c char(60) not
null)");
$i=1;
for (;;) {
$j="$i";
$dbh->do("insert into T values ($i, $i, $j)");
if ($i > 1) {
my $ni=$i-1;
$query="update T set p=$i where i=$ni";
$dbh->do($query);
}
if ($i > 2) {
my $di=$i-2;
$query="delete from T where i=$di";
$dbh->do($query);
}
$dbh->commit;
print STDERR ".";
$i++;
}
##############################################
This test just inserts a new row, updates the previous one (if a row
exists) and deletes another row. Then it commits this transaction.
My real test which is a mix of this two pieces of code "eat" about
4kb/s... It connects do some transactions, deconnect/reconnect and son
on...
I replace 'do' by 'prepare/execute' statements and things run really
better. But I'm quite anxious about the cx/dx. I suspect I forgot some
statements to properly clean up the DBI/DBD context after each
deconnection. Does somebody have the same kind of problems ???
A little help would be greatly appreciated!!
Thanks a lot!
Denis
PS: my context
* Perl 5.6.0, DBI-1.19, DBD-Oracle-1.08
* Oracle 8.1.7
$ perl -V
Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
Platform:
osname=linux, osvers=2.2.17-8smp, archname=i386-linux
uname='linux porky.devel.redhat.com 2.2.17-8smp #1 smp fri nov 17
16:12:17 est 2000 i686 unknown '
config_args='-des -Doptimize=-O2 -march=i386 -mcpu=i686 -Dcc=gcc
-Dcccdlflags=-fPIC -Dinstallprefix=/usr -Dprefix=/usr
-Darchname=i386-linux -Dd_dosuid -Dd_semctl_semun -Di_db -Di_ndbm
-Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Uuselargefiles'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usesocks=undef
Compiler:
cc='gcc', optimize='-O2 -march=i386 -mcpu=i686', gccversion=2.96
20000731 (Red Hat Linux 7.1 2.96-79)
cppflags='-fno-strict-aliasing'
ccflags ='-fno-strict-aliasing'
stdchar='char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=4
alignbytes=4, usemymalloc=n, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -ldl -lm -lc -lcrypt
libc=/lib/libc-2.2.2.so, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options:
Built under linux
Compiled at Mar 23 2001 12:49:50
@INC:
/usr/lib/perl5/5.6.0/i386-linux
/usr/lib/perl5/5.6.0
/usr/lib/perl5/site_perl/5.6.0/i386-linux
/usr/lib/perl5/site_perl/5.6.0
/usr/lib/perl5/site_perl
--
Denis Pithon phone +33 (0) 1 41 40 02 13
Software Engineer fax +33 (0) 1 41 40 02 01
Lineo High Availability Group mail [EMAIL PROTECTED]