PROBLEM SOLVED I guess I was too quick asking the monks on this one. It turns out the problem was with the DBD::ODBC module. I had an older version, once I updated to the current version in CPAN the problem went away.

I have several Perl programs that I maintain at work that have been running fine for years on various systems (WinXP, Win 2003, Linux). Recently we have deployed them for a new client on a 64 bit Windows 2008 Server running SQL Server 2008. The code ran fine for a bit then it stopped. Looking into it I saw that I was getting out-of-memory errors. Attempting to track down the leak I came up with the following sample program that withing a min or two claims about 40megs of memory and just keeps growing. Any ideas?

use strict; use warnings; use DBI qw(:sql_types); my $dbh = DBI->connect("DBI:ODBC:sample_db", "user", "pass"); my $query = $dbh->prepare("SELECT TOP 1 ID FROM TABLE"); while (1) { $query->execute(); while (my $row = $query->fetchrow_hashref() ){ print $row->{EV_EQ_ID} . "\n"; } $query->finish(); }

I'm running strawberry perl 5.12.2 but have been able to reproduce this on this box with the 5.10 build as well.

C:>perl -V Summary of my perl5 (revision 5 version 12 subversion 2) configura +tion: Platform: osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread uname='Win32 strawberryperl 5.12.2.0 #1 Fri Nov 5 05:17:27 20 +10 i386' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks +=undef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags =' -s -O2 -DWIN32 -DHAVE_DES_FCRYPT -DUSE_S +ITECUSTOMIZE - DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing -m +ms-bitfields - DPERL_MSVC`enter code here`RT_READFIX', optimize='-s -O2', cppflags='-DWIN32' ccversion='', gccversion='4.4.3', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsiz +e=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='lon +g long', lseek size=8 alignbytes=8, prototype=define Linker and Libraries: ld='g++', ldflags ='-s -L"C:\strawberry\perl\lib\CORE" -L"C:\s +trawberry\c\li b"' libpth=C:\strawberry\c\lib C:\strawberry\c\i686-w64-mingw32\li +b libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdl +g32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lw +inmm -lversion -lodbc32 -lodbccp32 -lcomctl32 perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lc +omdlg32 -ladva pi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr + -lwinmm -lver sion -lodbc32 -lodbccp32 -lcomctl32 libc=, so=dll, useshrplib=true, libperl=libperl512.a gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-mdll -s -L"C:\strawberry\perl\lib\ +CORE" -L"C:\st rawberry\c\lib"' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PL_OP_SLAB_ALLOC USE_ITHR +EADS USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF USE_SITECUSTOMIZE Built under MSWin32 Compiled at Nov 5 2010 08:39:08 @INC: C:/strawberry/perl/site/lib C:/strawberry/perl/vendor/lib C:/strawberry/perl/lib .

In reply to Why is this leaking like a sieve? by bwigfield

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.