lua-users home
lua-l archive

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


>  Thu, 20 Feb 2003 16:22:21 -0300
>  Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
>
>  > The  problem was:  in lua-4.0.1,  on 64  bit machines,  forced garbage
>  > collection via  lua_setgcthreshold(L,0) does not run, while  on 32 bit
>  > it runs.  Eg. on SGI, cc -32 and cc -64 result in different behaviour.
>  
>  We are very sory. We knew about that bug :-(  Jeff Petkau reported it
>  to us in November 2002, but in the context of 4.1w4/5.0a. We corrected it
>  in 5.0b, but forgot to check 4.0.
>  

Well, never mind. I learned a lot on lua garbage collection now ;-)

[...]  
>  
>  Maybe we will release a 4.0.2 with this bug fixed, but in the meanwhile
>  it would be good if you put the patch on the wiki. 

It is there now. It does not change the API.

> But note that you
>  do not need to change the type of the parameter (that is, you do not
>  need to change lua.h). You can correct all in lapi.c:
>  
>  ++  #define GCscalel(x)              (((x)>>10)) 
>      (notice that this is a new macro, different from GCscale)
>  
>  
>  --  if (newthreshold > GCscale(ULONG_MAX))
>  ++  if ((unsigned long)newthreshold > GCscalel(ULONG_MAX))

Please note,  that this way,  on typical 64  bit machines with  4 byte
ints (Alpha,  SGI) it  is not possible  to specify a  threshold amount
larger than 4GB, while they  might have more memory (actually, this is
the reason why  they are there).  While this does  not bother me, this
might be  an issue  for people allocating  their userdata  memory with
Lua. This  was the  reason for  my initial proposal  to put  long into
lua.h. If you consider this an  issue, IMHO it would be good to change
this in lua5.

Juergen