[prev in list] [next in list] [prev in thread] [next in thread] 

List:       dbi-dev
Subject:    Re: memory leaking
From:       Tim Bunce <Tim.Bunce () pobox ! com>
Date:       2001-11-14 12:46:04
[Download RAW message or body]

It's on my list to look into soon. Thanks.

Tim.

On Wed, Nov 14, 2001 at 10:45:55AM +0100, Polak Michal wrote:
> Hello,
> 
> there is memory leaking somewhere. I think it is in DBI.
> Please, try this source code (replace dbname, username and password,
> please):
> ###########################################
> use strict;
> use DBI; 
> my $sql = "INSERT INTO test01 select * from test02 where column01 = ?";
> my($database, $user, $password) = ('xmplibero@orcela','dbuser1','dbuser1');
> my $dbh = DBI->connect("dbi:Informix:$database", $user, $password, 
>   {RaiseError => 0, PrintError => 1, AutoCommit => 0, ChopBlanks => 1});
> $dbh->do ("CREATE TABLE test01 (column01 int NOT NULL,column02 char(10) NOT
> NULL)");
> $dbh->do ("CREATE TABLE test02 (column01 int NOT NULL,column02 char(10) NOT
> NULL)");
> for (1..100000) {
> 	my $sh = $dbh->prepare($sql);
> 	$sh->finish;
> }
> $dbh->disconnect;
> ###########################################
> 
> I have launched this script with those results:
> 
> memory leaking		SQL command
> --------------		-------------
> no			"INSERT INTO table1 SELECT * FROM table2 WHERE
> column01 = 1"
> no			"SELECT * FROM table2 WHERE column01 = ?"
> no			"INSERT INTO test01 (column01) values (?)"
> YES			"INSERT INTO table1 SELECT * FROM table2 WHERE
> column01 = ?"
> 
> with the SAME results on those configurations:
> 
> OS			db server		Perl version
> ----------		--------		------------
> HPUX 11.00		Informix		5.6.1
> HPUX 11.00		Informix		5.005_03
> Windows NT 4.0	Informix		5.6.1
> Windows NT 4.0	Informix		5.005_03
> Windows NT 4.0	MSSQL			5.6.1
> Windows NT 4.0	MSSQL			5.005_03
> 
> 
> So I think memory leaking is caused due to DBI.
> I do not believe there is the same bug in Informix and MSSQL with the same
> type of SQL command.
> But I have no another DB server to test it. :-(
> 
> Used packages:
> --------------
> DBI-1.18, DBI-1.20
> DBD-Informix-1.00.PC1
> DBD-ADO-2.1
> 
> P.S. I was monitoring memory allocation via "top" on HPUX (column SIZE) and
> via "Task manager" on Windows NT 4.0.
> P.S.2. I have temporarily solved this problem via fork (one fork per one
> iteration), but I think solving bug is better way.
> 
> Thank you for your time.
> Perl -V infos follow.
> --
> Michal Polak
> system programmer, TurboConsult s.r.o.
> mpolak@email.cz, michal.polak@turboconsult.cz
> ICQ: 106342077
> Tel: +420 5 32 161 111
> 
> 
> ***********************************
> 
> ** HP-UX 11.00
> 
> ***********************************
> 
> $ uname -a
> 
> HP-UX orcela B.11.00 U 9000/800 573706537 unlimited-user license
> 
> $ perl -V
> 
> Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
> 
> Platform:
> 
> osname=hpux, osvers=11.00, archname=PA-RISC2.0
> 
> uname='hp-ux orcela b.11.00 u 9000800 573706537 unlimited-user license '
> 
> config_args='-Dcc=gcc -Dprefix=/opt/perl/5.6.1_dynamic'
> 
> hint=previous, useposix=true, d_sigaction=define
> 
> usethreads=undef use5005threads=undef useithreads=undef
> usemultiplicity=undef
> 
> useperlio=undef d_sfio=undef uselargefiles=undef usesocks=undef
> 
> use64bitint=undef use64bitall=undef uselongdouble=undef
> 
> Compiler:
> 
> cc='gcc', ccflags
> ='-D_HPUX_SOURCE -L/lib/pa1.1 -DUINT32_MAX_BROKEN -I/usr/local/include',
> 
> optimize='-O',
> 
> cppflags='-D_HPUX_SOURCE -L/lib/pa1.1 -DUINT32_MAX_BROKEN -I/usr/local/inclu
> de'
> 
> ccversion='', gccversion='2.7.2.3', gccosandvers='hpux11.00'
> 
> intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
> 
> d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
> 
> ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
> lseeksize=4
> 
> alignbytes=8, usemymalloc=y, prototype=define
> 
> Linker and Libraries:
> 
> ld='ld', ldflags =' -L/usr/local/lib'
> 
> libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
> 
> libs=-lnsl -lnm -lndbm -ldld -lm -lc -lndir -lcrypt -lsec
> 
> perllibs=-lnsl -lnm -ldld -lm -lc -lndir -lcrypt -lsec
> 
> libc=/lib/libc.sl, so=sl, useshrplib=false, libperl=libperl.a
> 
> Dynamic Linking:
> 
> dlsrc=dl_hpux.xs, dlext=sl, d_dlsymun=undef,
> ccdlflags='-Wl,-E -Wl,-B,deferred '
> 
> cccdlflags='-fpic', lddlflags='-b -L/usr/local/lib'
> 
> 
> 
> Characteristics of this binary (from libperl):
> 
> Compile-time options:
> 
> Built under hpux
> 
> Compiled at Jun 1 2001 15:47:28
> 
> @INC:
> 
> /opt/perl/5.6.1_dynamic/lib/5.6.1/PA-RISC2.0
> 
> /opt/perl/5.6.1_dynamic/lib/5.6.1
> 
> /opt/perl/5.6.1_dynamic/lib/site_perl/5.6.1/PA-RISC2.0
> 
> /opt/perl/5.6.1_dynamic/lib/site_perl/5.6.1
> 
> /opt/perl/5.6.1_dynamic/lib/site_perl
> 
> ..
> 
> 
> 
> 
> 
> ***********************************
> 
> ** MS Windows NT 4.0
> 
> ***********************************
> 
> Summary of my perl5 (revision 5 version 6 subversion 1) configuration:
> 
> Platform:
> 
> osname=MSWin32, osvers=4.0, archname=MSWin32-x86
> 
> uname=''
> 
> config_args='undef'
> 
> hint=recommended, useposix=true, d_sigaction=undef
> 
> usethreads=undef use5005threads=undef useithreads=undef
> usemultiplicity=undef
> 
> useperlio=undef d_sfio=undef uselargefiles=undef usesocks=undef
> 
> use64bitint=undef use64bitall=undef uselongdouble=undef
> 
> Compiler:
> 
> cc='cl', ccflags
> ='-nologo -O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DPERL_MSVCRT_READ
> FIX',
> 
> optimize='-O1 -MD -DNDEBUG',
> 
> cppflags='-DWIN32'
> 
> ccversion='', gccversion='', gccosandvers=''
> 
> intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
> 
> d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
> 
> ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
> lseeksize=4
> 
> alignbytes=8, usemymalloc=n, prototype=define
> 
> Linker and Libraries:
> 
> ld='', ldflags
> ='-nologo -nodefaultlib -release -libpath:"l:\pgm\perl\5.6.1\perl\lib\CORE" 
> -machine:x86'
> 
> libpth=""C:\Program Files\Microsoft Visual Studio\VC98"\lib"
> 
> libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
> comdlg32.lib advapi32.lib shell32.lib ole32.lib
> 
> oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib
> odbc32.lib odbccp32.lib msvcrt.lib
> 
> perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
> comdlg32.lib advapi32.lib shell32.lib ole32.
> 
> lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib
> version.lib odbc32.lib odbccp32.lib msvcrt.lib
> 
> libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl56.lib
> 
> Dynamic Linking:
> 
> dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
> 
> cccdlflags=' ',
> lddlflags='-dll -nologo -nodefaultlib -release -libpath:"l:\pgm\perl\5.6.1\p
> erl\lib\CORE" -machine
> 
> :x86'
> 
> 
> 
> Characteristics of this binary (from libperl):
> 
> Compile-time options:
> 
> Built under MSWin32
> 
> Compiled at Jun 6 2001 20:02:09
> 
> @INC:
> 
> //MAKRELA/Shared/Pgm/Perl/5.6.1/perl/lib
> 
> //MAKRELA/Shared/Pgm/Perl/5.6.1/perl/site/lib
> 
> ..
> 
> 
> 
> 
> 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic