From: Lyle Johnson Date: 2001-09-11T21:25:09+09:00 Subject: [ruby-talk:21109] Re: Odd behaviour > It's me again.. After getting almost everything to work with embedding > Ruby into my game engine, i came across a bug, which might have to do > with ruby.. > > I have several C++ classes derived from the C++ "Object" base class > exported to ruby..... The Object base class ist also exported by the > name "GObject" to ruby... Ok now i have several ruby methods which > expect a "GObject" as their parameter..... ( So alle C++ Object > derived classes should work ) however this works randomly... Once it > works like a breeze the next time i start the programm the methods > don't recognize their parameters as beeing GObject or derived... > > I means the same build of my progam works one time, then not ... then > it works again.... when it works it's absolutly stable.. > > I have no clue.. does anybody have an idea what that could be ? Is it possible that you're not handling interactions with Ruby's garbage collector correctly, and that Ruby is destroying objects prematurely because they haven't been marked as "in use" by other objects that hold references to them? If that were the case, it would sort-of explain why your program works some times but not other times; you never know when the GC is going to kick in. As an experiment you could try disabling GC entirely by adding the line: GC.disable to the top of your program, then run it and see if the strange behavior persists. Just a thought, Lyle