[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Storing 'source file' from the debug API by reference
- From: Ivko Stanilov <ivko@...>
- Date: Wed, 12 Jul 2006 15:15:09 +0300
Hello all,
We are making a debug functionality that aims to store the X last
executed Lua source lines in a list. Is it OK to store the 'source'
field from the 'lua_Debug' structure as a pointer? (because copying a
string each time a Lua line is executed is very slow and not
plausible) Or is there any chance that they are garbage collected?
I looked through the source and saw that these strings are kept in
the Proto structures, which are created by the parser. I found the
following source lines (and comment), which make me think Proto
structures are not collected and thus it's safe to reference to the
strings kept there:
/* anchor table of constants and prototype (to avoid being collected) */
sethvalue2s(L, L->top, fs->h);
incr_top(L);
setptvalue2s(L, L->top, f);
incr_top(L);
Does anyone has information about this? When are Proto structures
garbage collected?
Thanks in advance