Subject: | Canvas / Textitem memory leak |
The following code makes the process grow by ~250 KB on each Button press.
Devel::Leak shows constant count of SV. Devel::Leak::NoteSV itself consumes Memory, therefore the call to NoteSV is commented out.
Tested with Ubuntu 14.04/ system perl 18.2 as well as perlbrew perl-5.16.3
Tk commit 934d1bdd3c8cefa9a88409c62de97919dc9a522a
On a Mac with perl-5.16.3 and cpan Tk 804.032 I can not reproduce this.
Subject: | canvasleak.pl |
use strict;
use warnings;
use Tk;
#use Devel::Leak;
my $dl_handle;
my $main = tkinit;
my $c = $main->Canvas->pack(-fill => 'both',
-expand => 1);
$main->Button(-command => \&create_text,
-text => 'Create',
)->pack;
my $items = 50;
my @ids;
MainLoop();
sub create_text{
for (0..9){
$c->delete('all');
@ids = ();
# warn Devel::Leak::NoteSV($dl_handle), "\n";
for my $count (0..$items){
my $id = $c->createText(50,$count* 10,
-text => 'o',
);
push @ids, $id;
$c->addtag('aTag','withtag',$id);
}
}
}