lua-users home
lua-l archive

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


> We're passing our memory allocator to lua_newstate, which means that
> Lua still uses it's gc behaviour, but all real memory allocation is
> controlled by our gc (since malloc, realloc, free and the like are
> passed to it). On paper it is safe, as long as the memory
> (de)allocation functions implement their contract (which they do). It
> would only break if Lua's memory management would
> a) store pointers to "supposed to be freed" memory without actually
> freeing it (it doesn't);

What do you mean by "supposed to be freed" memory?


>or b) it's behaviour is modelled with certain assumptions about the gc
>algorithm. It seems b) is also not the case by looking at the source,
>but I just wanted to ask, devil in the detail and that.

You said that Lua keeps its own gc implementation, so why (b) would
be a problem? Whatever Lua assumes about the gc algorithm will still
hold, as it uses its own algorithm.

I am afraid I still do not know what are your doubts.

-- Roberto