Im writing a Ruby extension and Im using the function Data_wrap_struct
.
In order to participate in Ruby's mark-and-sweep garbage collection process, I need to define a routine to free my structure, and a routine to mark any references from my structure to other structures. I pass the classic free
function to free the memory but I dont know how to use a mark function.
my structs sound like this
typedef struct
{
int x;
int y;
} A;
typedef struct
{
A collection[10];
int current;
} B;
I think that I need a mark function to mark the references in collection
of struct B.
Someone can show me a example to see how a mark function works?