lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

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);
  setptvalue2s(L, L->top, f);

  Does anyone has information about this? When are Proto structures
garbage collected?

Thanks in advance