in reply to Re: Out of Memory 2.
in thread Out of Memory 2.

Thanks for the response. It is hard to take "Are you being deliberately thick?" as not hostile.

The problem is large so I provided only a subset of what I am trying to solve, which appears confusing to folks. What I posted is an attempt to translate an algebraic solution into an expanded solution.

When that failed in the previous post, for this post I was attempting to see what folks did in the way of "paging" when programs got too big for memory. It appears this question is to abstract for this forum.

I've completed the first step which was to manually create array of arrays so I can page part of the data out to a database. With this I am up to 16 million array elements - only 8 million more to go. ;~)
$|=1; $/ = ','; my @letters; my @words; $words[0]=0; my $idxop; open POSTFIX, '<', 'postfix.txt' or die $!; while( my $op = <POSTFIX> ) { $idxop++; chomp $op; chop $op if $op =~ tr[\n][\n]; ## remove any trailing newline print "$idxop ($op) WORDS: $#words; LETTERS: $#letters\n"; if( $op eq 'x' ) { print "MULTIPY\n"; ## GRAB LAST TWO ELEMENTS FROM WORDS BY RANGES x1->x2-1;x2->x3 +-1 my $x3=pop(@words); my $x2=pop(@words); my $x1=pop(@words); my $elements=$x3-$x1; ## APPEND NEW VALUES ON TOP OF STACK $idx=$x3; for (my $i=$x2; $i<$x3; $i++) { for (my $j=$x1; $j<$x2; $j++) { $letters[$idx++]= $letters[$j] . $letters[$i]; } print "AT: $i toward $x3 with $#letters\n"; } ## DELETE OLD ELEMENTS splice @letters,$x1,$x3-$x1; ## PUSH POINTERS TO ENDS OF NEW ALGOMATED ELEMENT push(@words,$x1); $elements=$idx-$elements; push(@words,$elements); } elsif( $op eq '+' ) { print " ADD\n"; ## GRAB LAST TWO ELEMENTS FROM WORDS BY RANGES x1->x2-1;x2->x3 +-1 my $x3=pop(@words); my $x2=pop(@words); my $x1=pop(@words); ## PUSH POINTERS TO ENDS OF NEW ALGOMATED ELEMENT push(@words,$x1); push(@words,$x3); } elsif( $op =~ m/^\d+$/ ) { print " STORE NUMBER $op\n"; push @letters, pack 'v', $op ; #push @letters, $op ; $words[$#words+1]=$#letters+1; } else { die "Bad '$op' at position;" . tell( POSTFIX ); } }