Eric Hodel wrote in post #1061208:
> On May 17, 2012, at 12:31, Hans Mackowiak wrote:
>> i create an hash from the C-side, mark them with rb_global_variable and
>> then store my objects into them
>>
>> this protects my objects from being deleted.
>
>
> This is probably wrong.
>
> By using rb_global_variable the object can never be reclaimed by the
> garbage collector.
>
> You should either:
>
> Return a ruby object to the user that stores your Hash.
>
> Use Data_Wrap_Struct/Data_Make_Struct to store your Hash and use
> rb_gc_mark to indicate it is still alive.
>
> Use a constant, class or instance variable on a pre-defined class to
> store your Hash.



no its correct i want the control when the GC gets the object or not.
thats why i use a hash, when my binding removes the object out of the 
hash, GC deleteds it. but no earlier

-- 
Posted via http://www.ruby-forum.com/.