From: "Asbjørn Reglund Thorsen" Date: 2005-01-17T20:05:43+09:00 Subject: Re: [n00b] Garbage collection, Ruby C++ and SWIG The header file is located at http://folk.uio.no/asbjoert/MenuSystem.h On Sat, 15 Jan 2005, ts wrote: >>>>>> "A" == =?ISO-8859-1?Q?Asbj=F8rn Reglund Thorsen?= writes: > > A> I`m having trouble with an interface to a c++ library. It seems like > A> Ruby`s GC is collecting objects that it shouldn`t. I have read the > A> SWIG-Ruby documentation on the matter, but I am unsure of where to put the > A> markfunc , and how to get it to interact with my program. > > A> My interface file : mHeat1.i > > Well, difficult to say without seeing the source but probably the problem > has nothing to do with the mark function. > > A> #0 0x00000089 in ?? () > A> #1 0x40388c19 in free_MenuSystem () from ./mHeat1.so > A> #2 0x0806f636 in rb_gc_call_finalizer_at_exit () at gc.c:1858 > A> #3 0x08053e34 in ruby_finalize_1 () at eval.c:1418 > A> #4 0x08053f43 in ruby_cleanup (ex=0) at eval.c:1453 > A> #5 0x08054081 in ruby_stop (ex=135573240) at eval.c:1484 > > ruby is at the end (it will exist) and it call the finalizers : this is the > normal operation. > > There are many reasons for such a crash : > * free_MenuSystem() is called twice > * the free function must be called in a predefined order > * ... > > Difficult to say more without the source. > > Guy Decoux > >