Hi again, I have program that is initializing a perl LoL (array of arrays) by reading in comma separated lines from 20 different files and then storing contents in a 2-d array. I am clearing out the data structure at the end of each iteration so I don't adding rows to the array. But the program keeps allocating memory (almost but not quite running out). The program finished, but then the perl process is killed, the memory is not freed. I don't know if its something I'm doing with manipulating the 2-d matrix that is causing the memory leak. I did look at the the perlman:perllol doc which helped. But I think I might be doing something wrong still. Any help is appreciated. The code snippet is here:
# read in lines across 20 files while (1) { my $batch1 = <FILE1>; chomp($batch1); last unless ($batch1); ... my $batch20 = <FILE20>; chomp($batch4); # put the lines into an array # @batch_lines has 20 elements push(@batch_lines, $batch1); ... push(@batch_lines, $batch20); #init the 2-array @confidence_mtx after parsing out some #data for the # batch_lines elements foreach (@batch_lines) { next if /^Probeset/; my ($probe, $tmp) = split /\t/; push (@confidence_mtx, [ split /,/ , $tmp ]); } # do some lookups in the confidence_mtx data structure my $batchnumber = $sample2batch{$consensus_sample_batch}; my $offset = $sample2offset{$consensus_samples_offset}; if ( $confidence_mtx[$batchnumber-1][$offset-1] > $CONFIDENCE_CUTOFF) +{ $consensus_genotypes[$i] = '00'; } undef @confidence_mtx; } # close while(1) loop

In reply to using a perl LoL and almost running out of memor by ai56

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.