in reply to Re^3: what is difference between calling the function in Perl/Tk in the following ways
in thread what is difference between calling the function in Perl/Tk in the following ways

By adding \$arg1,\$arg2, the memory leak goes away? I don't think so.

  • Comment on Re^4: what is difference between calling the function in Perl/Tk in the following ways
  • Download Code

Replies are listed 'Best First'.
Re^5: what is difference between calling the function in Perl/Tk in the following ways
by choroba (Cardinal) on Apr 16, 2010 at 21:15 UTC
    Not only by adding the references, but also by including them into a list instead of using them directly. We tested it hundred times, really.
      That would be awesome, except you seem to have forgotten to post the test.
        We did the testing with perl 5.6 several years ago. Another danger of the non-list approach is that the function sees the lexical context of its definition and can accidentaly use something from there, which might also leak.

        As of now, perl 5.10.0, Tk 804.028, even this code leaks:

        perl -e 'use Tk;use Tk::Button;my $top = new MainWindow;for (1..100) { for (1..1000) { $top->Button(-text=>"foo")->destroy; } sleep 1; } '