ts <decoux / moulon.inra.fr> writes:

>>>>>> "C" == Christian Neukirchen <chneukirchen / gmail.com> 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

This makes a lot of sense in the after-thought, but I would have
expected ruby/dl to track all references for me... is this behavior
somewhere documented?

> Guy Decoux

Christian Neukirchen
<chneukirchen / gmail.com>