lua-users home
lua-l archive

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

Mark Hamburg wrote:
I have on occasion wanted a table.clear( t ) function that would clear the
table and release any associated memory. Basically, it reclaims memory ahead
of the GC and keeps the table identity fixed at the same time. How useful
this would actually be, I don't know.


I too have found myself wanting this on a few occasions, along with table.copy( t ) which would make a minimally-allocated shallow copy of the table (similar to the optimized size obtained when using an explicit table initializer, rather than the exponential growth of a dynamically extended one).

I will admit to not knowing whether these are artifacts of a 'premature optmization' or not.