[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: From Lua to Python?
- From: Coda Highland <chighland@...>
- Date: Tue, 6 Feb 2018 11:03:07 -0600
On Tue, Feb 6, 2018 at 9:06 AM, Tom Cook <firstname.lastname@example.org> wrote:
> On Mon, 5 Feb 2018 at 16:56 Coda Highland <email@example.com> wrote:
>> Lua's GC stops the world. All garbage collectors do. Lua's is just
>> reasonably well-behaved and tries to avoid big sweeps as much as
>> possible by doing smaller collections more often. It's also easier to
>> write Lua code that generates less garbage. And if you're doing
>> one-state-per-thread (the recommended way of doing it) then you're
>> only blocking one thread instead of the world.
> I am no expert on the ins-and-outs of garbage collection, but I understand
> this is not the case - see http://lua-users.org/wiki/LuaInRealTimePrograms.
That's saying the same thing I said with more precision. (Of course,
even the incremental collections have to stop the world; the idea is
to keep those as brief as possible.) The thing is, ALL garbage
collectors CAN hit pathological cases where you end up taking a long
time to clean up (the alternative is to leak memory), and Lua's is no
exception to that. The best you can do -- and Lua does a really good
job of it -- is to try to make the pathological case not come up for
typical patterns of use.