[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Garbage collecting 'expensive' userdata
- From: Coroutines <coroutines@...>
- Date: Fri, 28 Mar 2014 13:27:20 -0700
On Fri, Mar 28, 2014 at 1:21 PM, John Dunn <John.Dunn@qsc.com> wrote:
> If I have a userdata which is wrapping a limited resource ( file handle, socket, a huge block of memory ) is there a way to make the userdata exert pressure on the GC causing it to be cleaned up a quickly as possible? Ideally I'd like it to be cleaned up as soon as there are no references to the data but I don't want to have to call a global collectgarbage call all the time ( or at all ).
>
> John
>
I don't believe there is a way to prioritize collection of certain
object, not explicitly. Lua provides :close() off of file handles so
you can at least close the internal file descriptor while you wait for
the masking userdata to be collected. Perhaps you could do the same?