[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: state of the Lua nation on resource cleanup
- From: Roberto Ierusalimschy <roberto@...>
- Date: Tue, 17 Feb 2009 13:00:27 -0300
> Roberto wrote:
> > [...]
> >
> > That is, all resources should have an explicit "close" method plus
> > a finalizer that releases it. (Like files from the io library.) In
> > regular use, the control flow should call the close method for prompt
> > release. On exceptions, a full collection would call the finalizers.
>
> Hi Roberto. I'm concerned about some negative consequences this
> solution would have:
>
> * negation of incremental GC benefits - the point of the
> incremental garbage collector is to minimize wost-case collection
> cycle duration. Apps relying on this would be back to square one
> should an exception occur at any time (e.g. a video game might miss
> its frame deadline). [...]
For me, an exception is exactly the kind of thing that justifies the
miss of a frame deadline. (I could even use this as a definition of
what is an exception :) But this is a matter of taste...
> * difficulty for Lua implementations - there are a number of Lua
> VM implementations (e.g. Kahlua) which rely on the native GC of some
> particular language rather than porting Lua's memory management.
> [...]
I do not agree with this point. We are not going to restrict Lua design
space because of JVM limitations.
> Besides these, I think this solution overlooks the usefulness of
> having a cleanup mechanism that covers all exit cases.
This is a good point.
-- Roberto