lua-users home
lua-l archive

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


The automatic garbage collection in Lua, Java, C# etc. does not require you to do any of that, but it has a lot more overhead and does not free memory instantly, which is why the "<close>" facility was added in Lua 5.4.0.

let me double check to be sure I understand correctly: could one use <close> on tables and exploit this to free tables as soon as possible without waiting for the garbage collector to kick in?


No, __newindex can be used to block adding new keys, but you can still delete keys or modify the associated value. You can make a proxy table that blocks all modifications. This creates some overhead, though, and 'rawset' etc. will still ignore the readonly status. 

Thank you - I should have been more precise: yes a proxy table can do that!

--
Andrea Vitali






_______________________________________________
lua-l mailing list -- lua-l@lists.lua.org
To unsubscribe send an email to lua-l-leave@lists.lua.org