lua-users home
lua-l archive

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


Provided that all allocation is done through lua_newstate() you are quite
right.  It looks like it uses realloc in one place, the static function
l_alloc() in lauxlib.c.  I am puzzled however in that a search through the
source for the phrase _newstate  shows very few actual uses of the
allocator.  

Wait, actually it seems that lua_State() redefines luaL_newstate() which
redefines lua_newstate() in lauxlib.h.  That's probably how the allocator
gets propagated, since lua_State is called all over the place.

Thus I can either redefine realloc or even easier include gc.h in lauxlib.c
and replace realloc with GC_REALLOC().  An equivalent statement is probably
true for free() in the same function, which can be replace with GC_FREE().
--
View this message in context: http://www.nabble.com/Using-Lua-and-C-with-a-Garbage-Collector-t1281804.html#a3430079
Sent from the Lua - General forum at Nabble.com.