FFRANK has asked for the wisdom of the Perl Monks concerning the following question:
1- Is there a way during a while (<IN>), to first initialize everything (all variables, arrays, subs, etc.) in a single command (just curious).
2- Is there a way during a process to track/monitor exactly what (variable, array, hash) gets how much memory allocated.
Thanks very much
UPDATE: given the amount of data, %seen eating memory.
#!/usr/bin/perl -w use strict; use Algorithm::Loops qw(NestedLoops); sub combo { #thanks Roy Johnson my $something = shift; my %seen; my $combos = NestedLoops([$something->[0],map {my $_hold = $_; sub {[grep {!$seen{join(':', sort @_, $_)}++} @{$something->[$_hol +d]}]}} 1..$#$something]); my $value = 0; my ($result, $someFct); while (my @result = $combos->()) { if (someSub(\@result) > $value) { $result = join (',', @result); $someFct = (someSub(\@result)); } else {();} } return $someFct,"\t",$result,"\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Memory monitoring
by Fletch (Bishop) on Jul 03, 2007 at 17:07 UTC | |
|
Re: Memory monitoring
by educated_foo (Vicar) on Jul 03, 2007 at 17:09 UTC | |
by FFRANK (Beadle) on Jul 03, 2007 at 17:24 UTC | |
by naikonta (Curate) on Jul 04, 2007 at 01:58 UTC |