[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Object lifetimes inside Lua (3.1)
- From: roberto@... (Roberto Ierusalimschy)
- Date: Thu, 1 Jun 2006 15:38:14 -0300
> Are there any guarantees made with regard to the validity of pointers
> inside Lua code? That is, suppose we look at luaV_execute -- is the
> TProtoFunc* guaranteed to be valid after the luaV_execute call
> finishes, or are internal pointers (which are derived from
> lua_Object's) liable to be garbage collected like everything else?
Lua code does not bother to clear pointers it is not going to use
again, and/or to correct them before it needs. So there are several
places along the code where pointers may be invalid. For instance, in
luaV_execute there are several calls that potentially may reallocate the
stack and therefore invalidate 'ra'. But 'ra' is corrected only when/if
needed.
-- Roberto