lua-users home
lua-l archive

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


Roberto Ierusalimschy wrote:
> Moreover, table.clear should be able to release the memory used by the table
> immediately, independent of the GC.

That's not the intended use case. This is about recycling a table
for the same or a similar context. Keeping the current hash/array
sizes is considered beneficial.

That's where the name comes from: table.clear() only 'clears' the
keys/values from the table. It doesn't change the sizes, it doesn't
shrink or reset the table (which would be much less useful in
practice).

--Mike