Re: [luabind] Help with adopt and Lua/C++ ownership
Brought to you by:
arvidn,
daniel_wallin
From: Sean B. <se...@gm...> - 2006-09-25 01:30:36
|
Thanks for thre response - I totally forgot to close the lua state when I was done! So yes, now the __finalizer and the C++ destructor are called upon application exit. It's too late for my needs but it is a start. I tried multiple calls to collectgarbage() but that didn't help (good thing to know anyhow). On 9/24/06, Arvid Norberg <ar...@cs...> wrote: > > > On Sep 24, 2006, at 06:44, Sean Barton wrote: > > > Hello all. I've got a derived class in Lua that I want to have > > garbage collected but I'm obviously not doing something right. I'm > > guessing the adopt policy gives me what I want but I haven't had > > any luck with it yet. > > [...] > > > And finally, here I am invoking all this in Lua script: > > > > myTest = MyFoo() > > myTest:Greeting() > > myTest = nil > > collectgarbage() > > > > Here's the output from all this: > > > > MyFoo:__init called! > > Hello, Luabind World! > > > > > > I would expect __finalize() on the lua-derived MyFoo class to be > > called as well as the original C++ Foo destructor, yet neither is > > happening. Can someone clue me in to what I'm missing? > > They aren't even called when you close the lua state? Usually you > would have to call collectgarbage() twice before the instance is > collected (this is because there's a double reference, and the first > time the table is collected, and the second time the actual object, > no longer held by the table, is collected). > > -- > Arvid Norberg > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > luabind-user mailing list > lua...@li... > https://lists.sourceforge.net/lists/listinfo/luabind-user > |