From: Christian Boos Date: 2002-08-13T23:10:43+09:00 Subject: RE: Data_Make_Struct Considered Dangerous? Hi, my two cents on that issue: > -----Original Message----- > From: William Djaja Tjokroaminata [mailto:billtj@y.glue.umd.edu] > Sent: Tuesday, August 13, 2002 3:50 PM > To: ruby-talk ML > Subject: Data_Make_Struct Considered Dangerous? > > ... > > Right now, the solution is simply to add this line: > > .... > ptr->data2 = Qnil; > ptr->data2 = Data_Make_Struct (cInner...); > .... > > I don't know whether this is really all there is to it. At least, for > people who don't understand, the code may look funny, because it seems > the Qnil assignment is just a waste. To me, this doesn't look funny, this looks just THE right thing to do: secure already existing data structures reachable from the GC before possibly triggering the GC. Maybe some more information about this issue in README.ext wouldn't hurt, but I don't want a restricted, "safer" C API. For instance, ALLOC is an useful wrapper on top of malloc, because if needed, it can free memory by triggering a GC. -- Christian