develooper Front page | perl.perl6.internals | Postings from February 2001

Re: Garbage collection (was Re: JWZ on s/Java/Perl/)

Thread Previous | Thread Next
From:
Hong Zhang
Date:
February 15, 2001 13:59
Subject:
Re: Garbage collection (was Re: JWZ on s/Java/Perl/)
Message ID:
040501c0979b$cb0150c0$2d031dc0@wora
> Hong Zhang wrote:
> 
> > This code should NEVER work, period. People will just ask for trouble
> > with this kind of code.
> 
> Actually I meant to have specified ">>" as the mode, i.e. append, then
> what I originally said holds true.  This behaviour is predictable and
> dependable in the current perl implementation.  Without the >> the file
> will contain just "bar\n".

That was not what I meant. Your code already assume the existence of
reference counting. It does not work well with any other kind of garbage
collection. If you translate the same code into C without putting in
the close(), the code will not work at all.

By the way, in order to use perl in real native thread systems, we have
to use atomic operation for increment/decrement reference count. On most
systems I have measured (pc and sparc), any atomic operation takes about
0.1-0.3 micro second, and it will be even worse on large SMP machines.
The latest garbage collection algorithms (parallel and cocurrent) can 
handle large memory pretty well. The cost will be less DF.

Hong


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About