From: Alexander Kellett Date: 2004-12-28T18:54:21+09:00 Subject: Re: Garbage collection trouble i'm right in saying that i haven't messed up with gc if when i call GC.disable it still fails right? (i'd made that assumption, but was not sure if it was correct) Alex On Dec 28, 2004, at 10:26 AM, ts wrote: >>>>>> "C" == Christian Neukirchen writes: > > C> Could you maybe explain *why* that "fix" works? > > Well, when you work with 'dl', this is like when you write an > extension, > you must help ruby and say it which variable must be marked. > > In your case, when ruby leave #initialize it will not able to see that > `source' is used internally by libxml2. This is why the GC remove it. > > If you store it in an instance variable, ruby will mark it and it > will be > available to libxml2, even after the end of #initialize > > > Guy Decoux > > >