Chris Wagner wrote:
>> Or, as your question partially suggests, use threads: ending a thread will
> release the memory back to OS.
>
> Really?
Yes, here's an example (takes about 200M of memory and releases it):
_________
#!/usr/bin/perl -w
use strict;
use warnings;
use threads;
$| = 1;
sub start_thread {
my $count = shift;
my @var = 1 .. $count;
print 'Ok, we ate some memory...';
<>;
}
my $thr = threads->create('start_thread', 4_000_000);
$thr->join();
print 'We freed it';
<>;
print 'Let us eat again... ';
$thr = threads->create('start_thread', 4_000_000);
$thr->join();
print 'We freed it';
<>;
_______
> Is that documented anywhere? Knowing that could've saved me a lot
> of trouble on a massively threaded long running application I made a while
> ago.
I'm not sure. Ending thread on Windows deallocates memory as it said in MSDN,
but I'm not exactly sure how Perl handles
all this stuff.
> Perlthrtut should have that kind of information. Who maintains that?
perl5_porters, I believe.
--
Serguei Trouchelle
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs