[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: caching pointers to Lua strings?
- From: Peter Cawley <lua@...>
- Date: Fri, 10 Jun 2011 10:11:38 +0100
On Fri, Jun 10, 2011 at 9:55 AM, steve donovan
> On Fri, Jun 10, 2011 at 10:42 AM, Reuben Thomas <firstname.lastname@example.org> wrote:
>> You can get away with it for a short time under normal circumstances,
>> i.e. when there's no GC before you use the string, but it will bite
>> you in the end!
> So presumably you can get away with it if you explicitly create a
> reference to the string with luaL_ref?
> Then of course you need to know when to release that reference.
I interpret the manual to mean that should a Lua implementation use a
moving GC, it is only required to fix the address of strings while
they live on the stack, and is free to move them around once they are
off the stack.