J
Joe Bacigalupa
I'm pretty new to Ruby and running into some odd issues with my "mark"
function. Basically I have a situation like this
What happens is when my ruby_node_mark function is called and I grab the
Node* that value is some chode memory value like 0xfdfdfdfd. I'm
wondering if anyone has run into any problems like this where it seems
that some variables are being deleted twice or something like that.
function. Basically I have a situation like this
Code:
void ruby_node_free( void* ptr ){
delete reinterpret_cast<Node*>( ptr );
}
void ruby_node_mark( VALUE self ){
Node* ptr = reinterpret_cast<Node*>(DATA_PTR(self));
if( ptr ){
// these are all ruby arrays
rb_gc_mark( ptr->verts );
rb_gc_mark( ptr->normals );
rb_gc_mark( ptr->uvw );
}
}
void ruby_node_alloc( VALUE klass ){
Node* ptr = new Node;
VALUE object = Data_Wrap_Struct( klass, ruby_node_mark,
ruby_node_free, ptr );
return( object );
}
What happens is when my ruby_node_mark function is called and I grab the
Node* that value is some chode memory value like 0xfdfdfdfd. I'm
wondering if anyone has run into any problems like this where it seems
that some variables are being deleted twice or something like that.