in reply to Re: module problems
in thread module problems

ok i want to do the same thing as:
for(my $i...){ system ("perl foo.pl X Y"); ... }
but this seams as pretty "hammered" way to do this . Why? because this is the only way i now how to clear my memory, all other functions do not work, if i don't do this it seams that perl looses the tag that tells him where he left some peace of data, and he can't clear the memory every time he repeats the process (so i have a hudge memory leakage). memory builds until there is no free memory left so the program crashes finaly.

:)

Replies are listed 'Best First'.
Re^3: module problems
by GrandFather (Saint) on May 16, 2008 at 22:47 UTC

    Given that leaks are often an indication that there a foible (bug?) in the code maybe a better thing would be to track down and fix the leak?

    Tools such as Devel::Size, Devel::Leak and Devel::DumpSizes will help. Note that if you want to use Devel::Leak with recent versions of Perl apply the patch at rt://22587 (thanks lima1). The discussion in Tracking down memory leaks may be of some help.

    On a different topic: Your C is showing! The Perlish way to iterate over a range is:

    for my $index (1 .. 500) { }

    which is shorter, clearer and more maintainable.


    Perl is environmentally friendly - it saves trees