From: Lyle Johnson Date: 2003-04-29T05:03:50+09:00 Subject: Re: c++/ruby debugging advices Simon Strandgaard wrote: > There must be others than me who is mixing c++ & ruby. > When bad things happens, How do you debug it? Many of the problems I seem to run into when mixing C++ and Ruby have to do with Ruby objects being garbage-collected before I expect them to be (because of errors in my code). Or, alternately, Ruby continuing to use objects that contain pointers to C++ objects that have already been destroyed without Ruby's knowledge. So one way to try to debug this is to add lots of (temporary) print statements in your code, to trace exactly when and where objects are being created and destroyed. For this to be effective, you of course need to have a clear understanding in your mind of what you would expect to see, if the program's working properly ;) Another thing you could try is to use a memory debugging tool. If you're running Linux, I really recommend Valgrind.