lua-users home
lua-l archive

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


Hi,

On 15 July 2018 at 15:22, John Belmonte <john@neggie.net> wrote:
> It's been about 10 years since my post "state of the Lua nation on resource
> cleanup" [1].  The only relevant thing that's happened in this area since
> then was Lua getting pcall + coroutine love in 5.2.
>
> [1] http://lua-users.org/lists/lua-l/2009-01/msg00333.html

I don't believe it is technically possible to implement deterministic
cleanup of objects in Lua. I think the main issue is Lua's approach of
throwing exceptions using longjmp. As far as I know, you need
systematic stack unwinding in order to implement something like this -
and that would be impossible to do while keeping Lua's primary design
criteria - to be small and portable.

If you have a technical solution that works - or if anyone else has -
would be happy to be corrected.

Regards
Dibyendu