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

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

From:
James Mastros
Date:
February 14, 2001 07:17
Subject:
Re: Garbage collection (was Re: JWZ on s/Java/Perl/)
Message ID:
20010214101743.C1258@lilith.belledonna.mine.nu
On Wed, Feb 14, 2001 at 09:59:31AM -0500, John Porter wrote:
> James Mastros wrote:
> > I'd think that an extension to delete is in order here.  Basicly, delete
> > should DESTROY the arg, change it's value to undef,...
> Huh?  What delete are you thinking of?  This is Perl, not C++.
Umm, perldoc -f delete?

Come to think of it, this doesn't mesh purticularly well with the current
meaning of delete.  It does, however, with undef.  In fact, it /is/ the
current meaning of undef, except for the GC part.  And perhaps the GC should
be explicit or automatic, but not implicit.

> > ...and trigger a GC that will get rid of the arg.
> No.  Perl decides for itself when to do GC.
That's almost certianly a mistake.  The programmer often /does/ know the
expectations of the end-user better then the interpreter.  If the programmer
can GC when /he/ wants to, he can do so when the pause will have the least
effect.

Think of a program that you want to run near-realtime most of the time, but
where you have a bit of downtime every now and again.  A game comes
immedetly to mind.

Or, for that matter, a program that spawns an external process that might
take a lot of memory, so does a GC before spawning it.  (Because otherwise
the OS will happily page out your garbage, resulting in massive amounts of
unneeded IO.)

	  -=- James Mastros
-- 
"All I really want is somebody to curl up with and pretend the world is a
safe place."
AIM: theorbtwo 	     homepage: http://www.rtweb.net/theorb/



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