lua-users home
lua-l archive

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


On Thursday, May 27, 2010, Jerome Vuarand <jerome.vuarand@gmail.com> wrote:
> I have a question too, about the emergency gc. Is it planned to
> provide a C API to trigger it explicitely ?
>
> My use case would be a I/O library, which open files. If the
> underlying operating system returns an error of the kind "no more file
> descriptor available", it would be nice to trigger an emergency gc,
> hoping for some of the collected userdata to release such file
> descriptors. After all, even if the Lua GC manages only memory, it
> also indirectly manages any resource held by userdata objects and
> released on __gc calls.

Is there a reason you can't use a normal collection? The emergency
collection doesn't run finalizers[1], so it wouldn't actually help in
your situation.

    henk

[1] http://lua-users.org/lists/lua-l/2010-05/msg00553.html