davis has asked for the wisdom of the Perl Monks concerning the following question:
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:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Have I found a memory leak?
by dragonchild (Archbishop) on Dec 12, 2003 at 13:35 UTC |