lua-users home
lua-l archive

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



On 24-Sep-06, at 7:33 PM, Glenn Maynard wrote:
    iFreeListRef = ref;
    if(ref == iMaxReference)
        --iMaxReference;

I think that should be:

    if (ref == iMaxReference)
        --iMaxReference;
    else
        iFreeListRef = ref;

Otherwise, you'll give out the same references twice.

You may find it faster to nil out the reference table entry, and keep the free list in your own private datastructure; it's possible that your compiler is not generating good code for converting between integer and floating point. (In general, you should use lua_pushinteger with lua 5.1, I think.) You could also try storing the freelist indices coerced to (void *) and wrapped as lightuserdata.