[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Issues with the garbage collector
- From: Sam Roberts <sroberts@...>
- Date: Thu, 30 Nov 2006 15:35:17 -0800
On Thu, Nov 30, 2006 at 01:52:26PM -0800, Wesley Smith wrote:
> obviously myvar won't. It was my (apparently wrong) understanding
> that local values at global scope would persist at the global level.
> However, this isn't the case. Where do they exist and to what extent
> do they exist?
I think they exist until the end of their enclosing scope. In your
example, you have a local, then the script ends... that can't actually
be your whole script, it would run and exit. When you load a chunk, it's
like creating an anonymous function. Then when you call the chunk, it
runs, creates the local, finishes the chunk, and any locals are
available for garbage collection...