[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: File descriptors and local variables
- From: steve donovan <steve.j.donovan@...>
- Date: Tue, 5 Nov 2013 09:23:42 +0200
On Tue, Nov 5, 2013 at 9:11 AM, Paul K <paulclinger@yahoo.com> wrote:
> when the handle is garbage collected after going out of scope, but
> does it go out of scope immediately (as it's not assigned to anything)
No such guarantee! It will be collected whenever Lua feels like doing
a collection - there is no concept of immediate finalization.
So in general, better to close the handle immediately and wrap it all
up in an exists() function.
(Deterministic finalization _would_ be a cool feature, and naturally
it has been discussed before)