Q: lua garbage collection experience I've gone over the manuals, online posts about the "expected" behavior of lua garbage collection for tables. The question is if someone has experience with this in a real use-case.
I have a table to which over time we continuously keep adding & removing (setting to NULL) entries. Some entries may not get removed (due to various reasons - not relevant in this context). What will happen to these entries over a period of time? Ideally, I would like to have them purged from the table (aged out, garbage-collected out, etc.) so that the memory footprint doesn't bloat.
Any real-world examples to deal with this would be very useful.

A: Lua's garbage collector is part of its memory management. It's an incremental garbage collector. Its purpose is to free unused memory. From time to time it collects everything that is not accessible from a root set including the global table _G, the main thread and a few other nodes. So the only criterion is if Lua is still able to access the memory through any set of references.
Once you have set the last reference to that memory nil that memory may be garbage collected.
This has nothing to do with the time since you last used a value or automatically getting rid of things you consider obsolete.
If you want to keep track of your table elements age you have to store a time stamp for every element and delete the element yourself once it's obsolete.
