[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: GC "survey"
- From: Joe Myers <joe31416@...>
- Date: Sun, 25 Aug 2002 22:38:33 -0400 (EDT)
This has been a very interesting thread.
Since there are always tradeoffs involved in various approaches, what I
personally would find most useful would be a couple of (totally
optional) commands one could give the compiler to 'do something
special'.
In other words, say (for example) we're using mark & sweep, but (as
paul@theV.net mentioned), we have some tables we KNOW will stay constant,
so a declaration like
live_forever(table1, table2, ...)
would remove the referenced objects from garbage collection. Well, sure,
the downside is you might run out of memory. In which case you remove the
statement. ... On the other foot, if you're running up against a specific
problem and are bumping up against constraints, judicious hints to the
compiler could be very useful.
Another compiler 'hint' I'd like to see:
clobber(object1, something_else2, ...)
I'm thinking of the case:
s = {'a', 'b', 'c'}
t = s
... -- a few hundred lines of code later
t = nil
Well, that sure eliminates t, but s still lives! And (here I don't know),
if even we did a
s = nil
wouldn't table {'a', 'b', 'c'} be floating around (unreferenced) til the
next garbage collect?
So I'd like 'clobber' to brutally annihilate the underlying objects
allocated, and release the space immediately to the free pool.
((Aside: is this what happens right now to locals when they go out of
scope?))
((Aside#2: heck I'm not a purist, these 'hints' could simply be C
functions manipulating the lua VM!))
Joe