[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Reentrant GC
- From: Coda Highland <chighland@...>
- Date: Mon, 26 Nov 2018 21:51:57 -0600
On Mon, Nov 26, 2018 at 8:53 PM Soni L. <email@example.com> wrote:
> Has anyone made a reentrant Lua GC, to allow garbage collection within __gc metamethod?
> I could really use this, but it doesn't seem to be a thing.
That's not the first thing I think of when I hear "reentrant." Lua's
GC *is* reentrant by the definition I usually use, which is to say
that multiple threads can GC distinct Lua states concurrently.
Reentrancy by the notion you suggest sounds pretty tricky. I can
envision how to do it if I were to build a GC from scratch, but given
how much of a niche use case it is I'm not sure if it would be worth
What's your use case? Why can't you do something like queue up an
action inside your __gc metamethod that you can process after the
sweep has ended?