Hi, At Tue, 17 May 2005 07:40:31 +0900, Ara.T.Howard wrote in [ruby-talk:142850]: > i reading some code attm that goes: > > static VALUE convertgslmatrixToRubyMatrix(gsl_matrix *dm) > { > int i, j; > volatile VALUE result; > assert(dm); > // printf("Trying to convert dm %p\n", dm); > // printf("With size %d, %d\n", dm->size1, dm->size2); > volatile VALUE rows = rb_ary_new(); > rb_gc_mark(rows); > for (i = 0; i < dm->size1; i += 1) { > volatile VALUE currow = rb_ary_new(); > rb_gc_mark(currow); > rb_ary_push(rows, currow); GC may run while resizing rows, however many platforms don't have the problem. And rb_gc_mark() isn't sufficient in theory but volatile with currow avoids it, so rb_gc_mark() isn't needed here at all. > for (j = 0; j < dm->size2; j += 1) { > double val = gsl_matrix_get(dm, i, j); > VALUE rval = rb_float_new(val); > rb_gc_mark(rval); Therefore volatile before rval is better than rb_gc_mark() also here. > rb_ary_push(currow, rval); > } > } > result = rb_funcall(cMatrix, rb_intern("rows"), 2, rows, Qnil); > rb_gc_mark(result); No meanings at all. > return result; > } > -- Nobu Nakada