I've been using the Spreadsheet::ParseExcel module to extract information out of ~2000 excel files, and I've found what I believe to be a memory leak in that module. Code that (I believe) demonstrates the problem:

#!/usr/bin/perl use warnings; use strict; use Spreadsheet::ParseExcel; use Devel::Leak; my $handle; my $num_vars = Devel::Leak::NoteSV($handle); { my $filename = "9000.xls"; my $oExcel = new Spreadsheet::ParseExcel; die "No excel obj\n" unless $oExcel; my $oBook = $oExcel->Parse($filename); unless($oBook) { die "Parsing of file $filename failed: $!\n"; } } my $new_num_vars = Devel::Leak::CheckSV($handle);

Because that code prints out a lot of information about variables (example below with apologies for duplicated code tags), I believe there's a memory leak in Spreadsheet::ParseExcel. If I change the code above to a simple for() loop within the same naked block, then I don't get any output.

new 0x8152d54 : SV = PVGV(0x852b8a0) at 0x8152d54 REFCNT = 1 FLAGS = (GMG,SMG,MULTI) IV = 0 NV = 0 MAGIC = 0x852b910 MG_VIRTUAL = &PL_vtbl_glob MG_TYPE = PERL_MAGIC_glob(*) MG_OBJ = 0x8152d54 NAME = "DESTROY" NAMELEN = 7 GvSTASH = 0x8169050 "Exporter" GP = 0x852b8d8 SV = 0x8152d90 REFCNT = 1 IO = 0x0 FORM = 0x0 AV = 0x0 HV = 0x0 CV = 0x0 CVGEN = 0x0 GPFLAGS = 0x0 LINE = 290 FILE = "/usr/lib/perl5/site_perl/5.8.0/Spreadsheet/ParseExcel.pm" FLAGS = 0x2 EGV = 0x8152d54 "DESTROY"

My actual questions:

  1. Have I found a memory leak?
  2. What do I do about it if I have?
  3. This item inserted because I thought I had another question, and I don't like lists with two entries
Update: I forgot to mention that I am using the latest version (0.2602) of Spreadsheet::ParseExcel


davis
It's not easy to juggle a pregnant wife and a troubled child, but somehow I managed to fit in eight hours of TV a day.

In reply to Have I found a memory leak? by davis

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.