[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua's GC in interactive applications (games)... feedback appreciated!
- From: "John Belmonte" <jvb@...>
- Date: Tue, 29 May 2001 16:11:06 +0900
Jonathan Branam wrote:
> I am trying to get some feedback on a number of work-arounds that I am
> considering.
>
> 1) I could run the GC manually, and have it take a set amount of time.
This
> way I could run it every couple seconds or so, but not let it take too
long.
> I can use the built-in feedback to find out if I need to run it more
often.
With Lua's garbage collector, you can't control how much time a gc cycle
takes, other than indirectly by controlling the number of objects in the
system. In other words, the length of a gc cycle would not be affected by
how often you forced a cycle. (This is assuming your ratio of
live-to-garbage objects is high.)
> 2) Avoid operations which cause orphans.
> 3) Extend Lua so that my new types are "built-in" such as the Number type.
I don't consider these general solutions. I wrote a little about this
previously, but the problem is that a gc cycle length is not only related to
how many garbage objects you've produced since the last cycle, but the total
number of all objects (whether they are being used or not). Don't forget
that functions count as objects.
> 4) Extend Lua's GC to be use more "active" ref counting.
I think Lua's mark-and-sweep collection is fine, it just needs to be made
incremental. I say "just", but it's probably not a few-day (or few-week)
project. Switching to reference counting is more of a sideways step than an
improvement, and will take just as much work.
Regards,
-John
p.s. also see my posting "dream garbage collector"