Re: bug in 5.0

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: bug in 5.0

Mike Pall-41
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