Threads and garbage collection

I apologize if this appears multiple times. When I did not see it
appear, I posted again.


Does perl have a feature like C# and Java where memory is reclaimed and
defragmented?


I just inherited 25K lines of perl code that uses lots of threads. A
simple grep indicates they have about 100 thread->new statements.


Back in 2005 Chris Devers responded to a similar post of mine and
suggested I use fork & exec instead.


Do threads necessarily leak memory in perl? That is the impression I got
from Chris Devers response on Jun 19 2005 10:28 in this email list
(although he did not specifically say that). The code I inherited is
running on FreeBSD. Since this is my second day on the job, I cannot log
in yet to check the version numbers.


Thanks,
siegfried


--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Siegfried Heintze [ Mi, 23 Februar 2011 17:52 ] [ ID #2055742 ]

Re: Threads and garbage collection

On Wednesday 23 Feb 2011 18:52:30 siegfried [at] heintze.com wrote:
> I apologize if this appears multiple times. When I did not see it
> appear, I posted again.
>
>
> Does perl have a feature like C# and Java where memory is reclaimed and
> defragmented?
>
>
> I just inherited 25K lines of perl code that uses lots of threads. A
> simple grep indicates they have about 100 thread->new statements.
>
>
> Back in 2005 Chris Devers responded to a similar post of mine and
> suggested I use fork & exec instead.
>
>
> Do threads necessarily leak memory in perl? That is the impression I got
> from Chris Devers response on Jun 19 2005 10:28 in this email list
> (although he did not specifically say that). The code I inherited is
> running on FreeBSD. Since this is my second day on the job, I cannot log
> in yet to check the version numbers.
>

I would suggest reading these:

* http://perldoc.perl.org/perlthrtut.html

* http://www.perlmonks.org/index.pl?node_id=288022

Threads in Perl 5 are error-prone and unreliable, and you should indeed use
either fork+exec (or forks.pm on CPAN) or an entirely different language where
threads are better supported such as C, Qt/C++, Erlang or C#/.NET (the latter
possibly with Mono).

Regards,

Shlomi Fish

--
------------------------------------------------------------ -----
Shlomi Fish http://www.shlomifish.org/
Understand what Open Source is - http://shlom.in/oss-fs

"My only boss is God. And Chuck Norris who is his boss."

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Shlomi Fish [ Mi, 23 Februar 2011 20:37 ] [ ID #2055744 ]

Re: Threads and garbage collection

2011/2/24 Shlomi Fish <shlomif [at] iglu.org.il>:
> On Wednesday 23 Feb 2011 18:52:30 siegfried [at] heintze.com wrote:
>> I apologize if this appears multiple times. When I did not see it
>> appear, I posted again.
>>
>>
>> Does perl have a feature like C# and Java where memory is reclaimed and
>> defragmented?
>>
>>
>> I just inherited 25K lines of perl code that uses lots of threads. A
>> simple grep indicates they have about 100 thread->new statements.
>>
>>
>> Back in 2005 Chris Devers responded to a similar post of mine and
>> suggested I use fork & exec instead.
>>
>>
>> Do threads necessarily leak memory in perl? That is the impression I got
>> from Chris Devers response on Jun 19 2005 10:28 in this email list
>> (although he did not specifically say that). The code I inherited is
>> running on FreeBSD. Since this is my second day on the job, I cannot log
>> in yet to check the version numbers.
>>
>
> I would suggest reading these:
>
> * http://perldoc.perl.org/perlthrtut.html
>
> * http://www.perlmonks.org/index.pl?node_id=288022
>
> Threads in Perl 5 are error-prone and unreliable, and you should indeed use
> either fork+exec (or forks.pm on CPAN) or an entirely different language where
> threads are better supported such as C, Qt/C++, Erlang or C#/.NET (the latter
> possibly with Mono).

Or the event driver like what AnyEvent does:

http://search.cpan.org/~mlehmann/AnyEvent-5.31/lib/AnyEvent. pm

--
Free SmartDNS Hosting:
http://DNSbed.com/

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
terry peng [ Do, 24 Februar 2011 04:15 ] [ ID #2055825 ]
Perl » gmane.comp.lang.perl.beginners » Threads and garbage collection

Vorheriges Thema: Dereferencing problem
Nächstes Thema: auto login to remote server using Net::SSH::Expect