From: Charles Mills Date: 2005-07-22T13:10:57+09:00 Subject: Re: C extension makes things slower Phil Tomson wrote: > In article <20050721220545.GL2279@tux-chan>, > Mauricio Fern�ndez wrote: > >On Fri, Jul 22, 2005 at 05:40:57AM +0900, Phil Tomson wrote: > >> Oh, for the sake of complete documentation in case someone has similar > >> questions in the future: > >[...] > > > >Just one minor simplification (also, for the record): > > > >> static void aco_point_free(void* p){ > >> free(p); > >> } > >> static VALUE aco_point_alloc(VALUE klass) { > >> VALUE object; > >> ACO_Point_Struct* point = (ACO_Point_Struct*)malloc(sizeof( > >> ACO_Point_Struct)); > >> object = Data_Wrap_Struct(klass,0,aco_point_free,point); > > ============== > > -1 > >This way, free() will be used (and you hence need no aco_point_free > >function). > > > > So you're saying it should be: > object = Data_Wrap_Struct(klass,0,-1,point); > > or: > object = Data_Wrap_Struct(klass,0,0,point); > > ? > > Phil I think he is saying: object = Data_Wrap_Struct(klass,0,free,point); Using -1 instead of free is not supported in 1.9. -Charlie