lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hmm...

I think it would be quite good to allow debugging of finalizers by default. A call/return hook can quite easily detect them and partially disable itself if desired.

I've had to debug finalizers before, and it sucked, altho it's not as annoying as the effects no-debug-gc has on sandboxing.

On Tue, Nov 27, 2018, 12:01 Roberto Ierusalimschy <roberto@inf.puc-rio.br wrote:
> > I still fail to see your point. The GC in Lua already is
> > "reentrant/recursive": you can freely call a garbage collection inside
> > a __gc metamethod. (Although, as others pointed out, this is smelly.)
>
> It disables debug hooks.

The disabling of debug hooks has nothing to do with being reentrant (at
least for I understand as reentrant). This is mainly to avoid confusion
when debugging, but maybe it would be better to allow hooks during
finalizers. The implementation can work both ways, without other
modifications than the setting of "allowhook'.

(Similarly, a finalizer stops the GC only to avoid confusion, such
as another finalizer being called during the finalizer. There is
nothing in the code that demands those restrictions.)

-- Roberto