[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: question about emergency gc (5.2work3)
- From: Jerome Vuarand <jerome.vuarand@...>
- Date: Thu, 27 May 2010 18:07:43 +0200
2010/5/27 Henk Boom <henk@henk.ca>:
> 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
I overlooked the fact that it doesn't run finalizers. Indeed it would
be useless to trigger an emergency collection in my use case. I guess
I can just trigger a regular collection then.