Hi all - this is my first post, so I hope I don't break any etiquette rules ;)
I'm writing a subroutine that seems to be causing my memory usage to spike...It is part of a larger program that is taking data (and metadata) out of a legacy data collection application and prepping it for import into a relational database.
I have narrowed it down to the following code (acutally, I have narrowed it down to one line, the line that dereferences $rDTX...I can't see why dereferencing something already in memory should cause mem usage to spike, but when that line is commented out, all is good.) It's unfortunate that it's such a large program, so I can't post the entire thing here, but any insight would be greatly appreciated.
open(OUT,">$outfile") || die "Can not open $outfile for writing ($!)\
+n";
my $ctr = 0;
for my $key (sort keys %$rDDT) {
$ctr++;
for my $quest (@{$$rMAP{'Order'}}) {
my $txqu = uc($quest);
for my $iter (@{$$rMAP{$quest}{'Iterations'}}) {
my $txit = sprintf "%03d", $iter;
my $qtyp = $$rMAP{$quest}{$iter}{'QType'};
my $card = sprintf "%02d", $$rMAP{$quest}{$iter}{'QCard'};
my $scol = $$rMAP{$quest}{$iter}{'QSCol'};
my $ecol = $$rMAP{$quest}{$iter}{'QECol'};
my $spos = $scol - 1;
my $flen = $ecol - $spos;
my $dat = $$rDDT{$key}{$card}{'data'};
my $mp = $$rDDT{$key}{$card}{'multis'};
my $rtxt = $$rDTX{$key}{$txqu}{$txit}{'ResponseText'}; # this i
+s the line that is causing me problems
if ($rtxt) { print "$rtxt\n"; undef $rtxt }
my $data = ();
$data = "$key\t".uc($quest)."_$iter\t";
$data .= getData($dat,
$mp,
$rQDI,
$card,
$scol,
$spos,
$ecol,
$rtxt
);
writeReport($data, $rOptions, \*OUT);
}
}
progressDisp($ctr);
}
print "\n\t$ctr respondents profiled\n\n";
close(OUT);
print "leaving makeProfiles()\n\n";
}
Thanks!
Edit kudra,
2001-10-31
Changed title
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.