lua-users home
lua-l archive

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


Hi,

Chromix wrote:
> I've created another variant of my demonstration script for 5.1,
> which uses 5 empty tables that occupy about 60MB of RAM.

Strange as it sounds, but tables are only shrinked when they need
to grow. So insert 'tTable.foo = nil' after collectgarbage() and
you'll see that the memory is freed. This is because the
insertion of a hash key (even a nil one) triggers the resize
function which notices the empty array part and frees it.

Deletions alone do not trigger the (expensive) resize function.

> If it is not a bug, it is at least unexpected behaviour.

The latter.

Bye,
     Mike