Re: detach method doesn't release memory (ithreads)

[email protected] (Steve Schein)
Newsgroups perl.ithreads
Message-ID <1081889044.2748.72.camel@Development>
Liz:

I put together some sample code below that generates the error to which
I've been referring using Perl 5.8.4RC1.  It should run fine on 5.8.0. 
My output is:

The new filehandle is: *main::FH
The number of items in the active user's data array is/are: 2
1111
Can't upgrade that kind of scalar at 584error.pl line 25.


__CODE__

#!/usr/local/bin/perl -w

use strict;
use warnings;

use threads;
use threads::shared;

my %foo : shared;
my $port = 1111;
my $rec = "bar";

my $fh_str = '>> /yourpath/port_'.$port; # add your path here
my $UDP_fh = &UDP_fh_open($fh_str);
print "The new filehandle is: $UDP_fh\n";

my @au_data_array : shared  = ($port, $UDP_fh);
my $au_data_array_ref = \@au_data_array;
my $num_au_items = @au_data_array;
print "Number of items in array: $num_au_items\n";

$foo{$rec} = $au_data_array_ref; 

print "$foo{$rec}[0]\n";
print "$foo{$rec}[1]\n";

sub UDP_fh_open {
    my $path = shift;
    open(FH, $path) || die $!;  
    return *FH; 
} # end sub UDP_fh_open
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.