First of all let me say that I dearly hope that the conditional
in this while loop has a typographical error:
while(($key, $msg) = each %$msg) {
process_msg($bs,$msg);
}
I hope you mean:
while(($key, $msg) = each %$record)
If you don't mean this, then this might be some of your
problem. Try renaming your hash value.
You can also make this much easier to read by using a foreach
loop (if you only want to handle the msg):
foreach my $msg (values %$records) {
process_msg($bd, $msg);
}
Anyway, I wanted to suggest that you look at Perl's profiling
package. It can't exactly help you find out where all your
memory is going, but it might help you track down where it's
being lost. (Note that you should definately be using "my"
for each of your variables to ensure that they don't hang around
out of scope.)
You can read about Perl's profiling package with perldoc
Devel::DProf
The shorts of it are to profile a script run the perl interpreter
with the -d switch. So perl -d:DProf test.pl. when
it's done, check the results by running dprofpp or
dprofpp -T.
I hope that helps. :) |