lua-users home
lua-l archive

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

Roberto Ierusalimschy wrote:
IIRC the number of cycles necessary depends on the depth of the data
to collect. For example
will require one cycle, while
  t = { t = { t = { t = { t = { t = {} } } } } }
will require 6 cycles.

Thanks Jerome, Roberto.

Probably what is happening in that program is this: when Lua reads
that huge string, an internal buffer grows to accomodate that string.
After that, it takes some collections for the buffer to resize to
a reasonable size again.

That would be the luaL_Buffer used in read_chars (@liolib.c), right?
I thought that since that structure is in C it wouldn't affect Lua's memory use (i.e, it would release its memory right away once it goes out of scope), but I see it uses the stack.

So, I'd have to take care of issuing enough collectgarbage's after reading large files or calling table.concat, right?