Re: [luabind] Another GC bug
Brought to you by:
arvidn,
daniel_wallin
From: Daniel W. <dal...@st...> - 2003-12-19 13:37:46
|
Thanks for reporting this. I don't think we will be able to take a look at this before the holidays, so it'll take a while. Tom Spilman wrote: > It seems I've found another GC leak from Luabind. Here is the simple > test case: > > -- main.cpp -- > > extern "C" { > #include <lua.h> > #include <lualib.h> > #include <lauxlib.h> > } > #include <luabind\luabind.hpp> > #include <luabind\object.hpp> > > > void fast_update( luabind::object self ) > { > // This call leaks memory to the > // GC that is not collected until > // lua_close() > self[ "_value" ] = 10; > } > > > int main( int argc, char* argv[] ) > { > // Setup lua > lua_State* L = lua_open(); > luaopen_base( L ); > luaopen_table( L ); > > // Startup luabind! > luabind::open( L ); > > // Expose our fast update function to the script. > luabind::function( L, "fast_update", &fast_update ); > > // Execute the lua script which does > // the rest of the test. > lua_dofile( L, "main.lua" ); > > // Cleanup. > lua_close( L ); > > return 0; > } > > > -- main.lua -- > > class 'object' > > function object:__init() > > self._value = 0 > > end > > function object:update() > > self._value = 10 > > end > > -- *** If I overload update to call my > -- *** 'C' fast update the GC will start > -- *** to grow fairly fast. Uncomment > -- *** this line to see the bug. > -- object.update = fast_update > > my_object = object() > > while true do > > my_object:update() > > print( "memory use = " .. gcinfo() ) > > end > > ---- > > This was tested with Lua 5.0.1 and a snapshot of Luabind from last > week. > > Tom > > > > > > > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: IBM Linux Tutorials. > Become an expert in LINUX or just sharpen your skills. Sign up for IBM's > Free Linux Tutorials. Learn everything from the bash shell to sys admin. > Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click > _______________________________________________ > luabind-user mailing list > lua...@li... > https://lists.sourceforge.net/lists/listinfo/luabind-user > -- Daniel Wallin |