Forum: Ruby pointer to c array in Ruby

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
John K (Guest)
on 2006-03-07 17:44
Beginner's question: I'm creating a large C array using ALLOC_N and I
want to pass that pointer to different C extensions.  I don't want to
create a Ruby array (i.e. using rb_ary_new4()) because I won't operate
on that array with any pure Ruby methods and I don't want the memcpy
overhead.  How can I assign a variable to that pointer in Ruby and how
do I prevent any garbage collection of my array?
Timothy G. (Guest)
on 2006-03-08 13:30
(Received via mailing list)

This explains how to use Data_Wrap_Struct and how to manage garbage
collection. The issue is not so much preventing garbage collection as
making it possible.
This topic is locked and can not be replied to.