I played with this a bit, and it looks like DBD::CSV is what is leaking. The below code leeks ~32K/iteration, and I think the leek is originating from the execute() of a statement that has a WERE clause.

If I drop the size of the where, clause it does not leak as much memory (removing it completely cause nothing to leak), and moving the connect & prepare out of the while(1) loop do not seem to do anything.

What version of SQL Statement do you have? I just tried upgrading to the latest version and that fixed the problem (But the new version is much slower, alas.)

$|++; use strict; use DBI; while(1) { my $dbh = DBI->connect("DBI:CSV:f_dir=./") or die "Cannot connect: " . $DBI::errstr; my $bob = $dbh->prepare("select * from foo where 1 = 1 OR 1=1 or 1=2 or 5.6=6 or 7=7 or 9=10 or 11=23 or 6=6 or 7=7 or 9=10 or 11=23 or 6=6 or 7=7 or 9=10 or 11=23 or 1 = 1 OR 1=1 or 1=2 or 5.6=6 or 7=7 or 9=10 or 11=23 or 6=6 or 7=7 or 9=10 or 11=23 or 6=6 or 7=7 or 9=10 or 11=23 or 1 = 1 OR 1=1 o +r 1=2 or 5.6=6 or 7=7 or 9=10 or 11=23 or 6=6 or 7=7 or 9=10 or 11=23 or 6=6 or 7=7 or 9=10 or 11=23 or 1 = 1 OR 1=1 or 1=2 o +r 5.6=6 or 7=7 or 9=10 or 11=23 or 6=6 or 7=7 or 9=10 or 11=23 o +r 6=6 or 7=7 or 9=10 or 11=23 or 1 = 1 OR 1=1 or 1=2 or 5.6=6 o +r 7=7 or 9=10 or 11=23 or 6=6 or 7=7 or 9=10 or 11=23 or 6=6 or 7=7 or 9=10 or 11=23 "); $bob->execute(); $bob->finish; print "."; sleep(1); }

In reply to Re: DBD::CSV Memory Leak by tantarbobus
in thread DBD::CSV Memory Leak by AcidHawk

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.