Re: Crash in wrapper_base.cpp
Drew McLean <[email protected]> Sat, 9 Jul 2011 16:51:58 -0700
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <CAGo0s8MwQOp2PJ-Ek6gwqUrdinUXgJcMAcn-4AqNcRQvRT68wA@mail.gmail.com> |
Heh, I may have spoken too soon. I think having that extra reference on the stack is preventing garbage collection of the items, even with an explicit collectgarbage() call. Any guess at why there wasn't a stack overflow? On Sat, Jul 9, 2011 at 4:44 PM, Drew McLean <[email protected]> wrote: > Ooops, seems like I messed up my previous runs of your sample code > somehow. I do indeed have different results for the different runs and have > attached them for you. I expect that they'll be the same as yours. For > reference, I'm using Visual Studio 2008 on Windows 7 x64 but I'm building a > 32 bit binary. > > More importantly though, I have come across 2 interesting observations. > I've been tinkering with your code and also the code in my engine and have > found a possible workaround. > > First, in my engine, if I simply add the following push of self onto the > stack before calling the lua function then no crash! > > lua_State *L = m_self.state(); > m_self.get(L); > call<void>("overide"); > > I find it weird that it didn't cause a stack overflow but I tried it many > times and let it run for a long time with no observed side effects other > than it seeming to be working correctly. > > The second observation is that when I put the extra push of self onto the > stack into your sample code before calling overide() it caused an assert. > After digging around I saw that you didn't provide a constructor for your > lua class. Adding that in made the assert go away and also got rid of the > "Lua instance is nil" messages. > > "function Item:__init(i)\n" > " print('lua constructor')\n" > "end\n" > > So it seems we may have stumbled upon a workaround if it deems to have no > side effects although I'm not really comfortable with not knowing why it > works. Let me know what you find with your engine. > > Drew > > -- Drew McLean Lead Tech Programmer A Priori Games (250) 508-3346 www.apriorigames.com ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ luabind-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/luabind-user