I just reproduced the result:#!/usr/bin/perl use warnings; use strict; use threads; use threads::shared; use Data::Dumper; use Config; printf "perl: %s\n", $Config{version}; printf "gcc: %s\n", $Config{gccversion}; printf "threads: %s\n", $threads::VERSION; printf "threads::shared: %s\n", $threads::shared::VERSION; my %hash :shared; sub sub1 { sleep 1; print STDERR threads->tid(); print STDERR Dumper \%hash; } $hash{a} = &share({}); my $th1 = threads->new('sub1'); $hash{b} = &share({}); my $th2 = threads->new('sub1'); $th1->join(); $th2->join();
$ ~/perl/recycleshare3 perl: 5.10.0 gcc: 4.3.2 threads: 1.67 threads::shared: 1.14 1$VAR1 = { 'a' => {}, 'b' => {} }; 2$VAR1 = { 'a' => {}, 'b' => {} }; $ ~/perl/recycleshare3 perl: 5.10.0 gcc: 4.3.2 threads: 1.67 threads::shared: 1.14 2$VAR1 = { 'a' => {} }; 1$VAR1 = { 'a' => {}, 'b' => {}, 'a' => {}, 'b' => {} };
In reply to Re^14: does threads (still) memleak?
by faxm0dem
in thread does threads (still) memleak?
by faxm0dem
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |