From: nobu.nokada@... Date: 2003-03-17T09:22:07+09:00 Subject: Re: method call on terminated object [W2k,1.6.8} Hi, At Mon, 17 Mar 2003 04:39:39 +0900, Michael Bruschkewitz wrote: > > > conn.read calls the following function from an own extension: > > > VALUE TCP_Read(VALUE self, VALUE maxL) { > > > CRbTcp* p; Data_Get_Struct(self, CRbTcp, p); > > > int ml = NUM2INT(maxL); > > > std::string data; > > > try { data=p->Read(ml); } > > > catch(CRbException & e) { > > > ext_raise(self,e.str(),__FILE__,__LINE__); } > > > return rb_str_new(data.data(),data.size()); > > > } > > > > Perhaps, you should check if you mark ruby objects properly. > > Just to be sure, for my problem: > class TC ; def initialize ; @s = '' ; end ; end > $tc = Testcase.new > # from here, tc.s should be valid (and never be terminated) until ... > $tc = nil > # ... here (after next GC)? Yes. > Is it possible $tc is not marked because it is assigned inside tc1.rb > here: > load 'tc1.rb' # tc1.rb: $tc = TC.new Global variables are always marked. > If I do not hold any references to Ruby objects inside my C++-classes, > do I still need to handle the mark-pass of GC? No, it should not be. > (rather, C++ objects are held inside TC-member variables) Do you mean an instance variable of ruby object (TC) holds raw C++ object? -- Nobu Nakada