lua-users home
lua-l archive

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

Roberto Ierusalimschy wrote:
> This is the result in my machine (N = 16). It seems quite stable...
>   18.9501953125
>   386.978515625

Yes, I thought so, too ... it works fine on Linux. But then I
tried it with the same version of Lua, compiled for Windows (with
either GCC or MSVC) and it grows without bound (and gets very


LuaJIT 1.x has the same problem, except on all platforms (even in
interpreted mode). I've already narrowed this down to the size of
the TValue struct. It's 12 byte on Linux and BSD* (because doubles
are only 4 byte aligned in the SYSV i386 ABI), but 16 byte on
Windows (doubles are 8 byte aligned in the Windows x86 ABI).

You can force 8 byte alignment (i.e. 16 byte TValue) for Linux
with the following change to lobject.h, line 75 in Lua 5.1.3:

  } __attribute__ ((aligned(8))) TValue;

Try it and you'll see, it grows without bounds now ...

My best guess is that the GC heuristics slow down the collector
too much if the size of the hash slots is 32 and not 28.