lua-users home
lua-l archive

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




On Tuesday, April 29, 2014, Spencer Parkin <spencertparkin@gmail.com> wrote:
Consider the following...

mytablaA = {}
mytableB = {}
mytableA.refB = mytableB
mytableB.refA = mytableA
mytableA = nil
mytableB = nil

There is no longer a reference to either table, yet they reference one another, so the tables are still around, right?  If so, will these tables never get garbage collected?

Lua does not use a reference counter for its GC and is able to avoid these issues. Since there is no path to these tables, they'll be collected.