Hi All,

I am totally new to perl threads, so I am sorry if what I am asking is absolutely basic
Just today I compiled perl 5.8.0 with threads on my m/c (linux redhat 7.2).
I find that one of the test of my test script dies with errors


this is my script reduced to the minimum


#!/usr/bin/perl use Data::Dumper; use threads;

my ($t1,@list);
$t1 = threads->create(sub { print  sleep(1) . "A $_ \n" foreach (0..5); });
print sleep(1)."B $_ \n" foreach (0..3);
@list = threads->list();print Dumper([\$t1,[EMAIL PROTECTED]);
$t1->join();
sleep(4);

# I Unhash this and I get no errors
#undef @list;

print "Bye \n";

__END__


if I do not undef @list I get a host of errors at the end


Attempt to free non-existent shared string 'create' during global destruction.
Attempt to free non-existent shared string 'join' during global destruction.
Attempt to free non-existent shared string 'list' during global destruction.
Scalars leaked: -2
Unbalanced string table refcount: (1) for "list" during global destruction.
Unbalanced string table refcount: (1) for "create" during global destruction.
Unbalanced string table refcount: (1) for "join" during global destruction.
Scalars leaked: 3


Can I not do without "undef @list" ??

So that means that every refernce to the threads I may create I must take care and undef them or perl leaves the thread refernces open if threads themselves have finished

This ofcourse is not much of a bother, I was just wondering that now perl also goes the C way that requires you to free all allocs

Thanks
Ram











Reply via email to