lua-users home
lua-l archive

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

I'm using LUA 5.1
I checked 5.3.4, lstate.c has not significant changes in these places,
setnilvalue in lobject.h has.

#define settt_(o,t)	((o)->tt_=(t))
#define setnilvalue(obj) settt_(obj, LUA_TNIL)

It seems it should not crash with this implementation.
I will try. Thanks.


-----Original Message-----
From: [] On
Behalf Of Roberto Ierusalimschy
Sent: Thursday, March 16, 2017 3:55 PM
To: Lua mailing list <>
Subject: Re: lua_newstate crashes on "setnilvalue(L, registry(L)); ",
lua_State L initialized with garbage?

> Once a few dozens of launching my app I notice crash on start, lua 
> initialization.
> Keeping in mind that this could be our-code issue, anyway I looked on
> lua_newstate() implementation.
> Here it is with my comments:
> [...]
> setnilvalue macro gives something like this:
> [...]
> 	if (i_o >= L->base && i_o < L->top && !stuckref(i_o))
> 	{
> 		i_o->value.gc->gch.refCount--;			// crashed

What version of Lua are you talking about? Lua does not use reference count
and nowhere in its code you would find a 'refCount' field.

-- Roberto