Front page | perl.perl6.language |
Postings from February 2001
Re: JWZ on s/Java/Perl/
From:
Dan Sugalski
Date:
February 10, 2001 10:51
Subject:
Re: JWZ on s/Java/Perl/
Message ID:
5.0.2.1.0.20010210134705.01b4a2b8@24.8.96.48
At 01:05 AM 2/10/2001 +0100, Bart Lateur wrote:
>On Fri, 09 Feb 2001 12:06:12 -0500, Ken Fox wrote:
> > 2. Work proportional to live data, not total data. This is hard to
> > believe for a C programmer, but good garbage collectors don't have
> > to "free" every allocation -- they just have to preserve the live,
> > or reachable, data. Some researchers have estimated that 90% or
> > more of all allocated data dies (becomes unreachable) before the
> > next collection. A ref count system has to work on every object,
> > but smarter collectors only work on 10% of the objects.
>
>That may work for C, but not for Perl.
>
> sub test {
> my($foo, $bar, %baz);
> ...
> return \%baz;
> }
>
>You may notice that only PART of the locally malloced memory, gets
>freed. the memory of %baz may well be in the middle of that pool. You're
>making a huge mistake if you simply declare the whole block dead weight.
This is an argument to make PMCs moveable, I suppose. I don't see what the
problem is in general, though--the pool of base variable structures might
get somewhat fragmented, but as it's a pool of fixed-sized structures there
are tricks you can play to make allocation quick even in a fragmented pool.
As for the actual contents of the scalars in %baz, that's no big deal
either. They can be moved about with impunity, and that's probably where
most of the space will get taken up anyway...
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
dan@sidhe.org have teddy bears and even
teddy bears get drunk