lua-users home
lua-l archive

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


> I believe that there is a little issue in the garbage collector
> implementation that was there all along at least since 5.1. This issue (at
> least this occurrence) does not affect stability and should have rather
> little performance impact, but I think it's worth fixing anyway, once
> confirmed.
> 
> [...]
> 
> The thing is, even with lsizenode equal to 0, sizenode(t) will return
> 
> ( twoto((t)->lsizenode) ) == ( 1 << ((t)->lsizenode) ) == ( 1 << 0 ) == 1
> 
> thus erroneously adding sizeof(Node) to the return value.

You are right, thanks for the feedback.


> To my mind, it could've been fixed by re-implementing sizenode:
> 
> #define sizenode(t)     ( (t)->lsizenode ? twoto((t)->lsizenode) : 0 )

This fix is not correct, because 'sizenode' is used in many other places
that assume this behavior; note that tables with no hash part share a
common hash part of size 1. When computing the memory used by the table,
we should check whether the table is using this shared dummy node (see
macro 'isdummy') to compute its memory use.

-- Roberto