Laurent Sansonetti
lsans****@apple*****
Tue Jun 6 01:35:48 JST 2006
Hi Kimura, It's strange, with my branch the test fails: 1) Failure: test_objc_rbclass(TC_RetainCount) [./tc_retaincount.rb:38]: alloc.initInRB. <2> expected but was <1>. I suspect this problem is fixed somewhere in the branch, though I don't know where exactly... I think it should be 1, as when the GC will do its pass the object will be released, as it will be decreased to 0. # I tested the branch with some of the Nib-based samples and I did not get crashes. Laurent On Jun 5, 2006, at 4:36 PM, kimura wataru wrote: > Hi, > > When a subclass has init methods and a instance generated from > Cocoa world (eg.Nib), retainCount of the object becomes "2". > This behavior is different from one of without ruby-definition > init methods, but GC will release the object sometime. > > I think this behavior is no problem. Don't you think? > > ex) > > class SubClass < OSX::NSObject > def init > super_init > # do something > return self > end > end > > ObjC-side Ruby-side retainCount retained > -------------------------- ----------- -------- > alloc 1 NO > | > init ----> + > | > + <---- super_init > | 1 NO > (return) - - > + > | 2 YES > < - - (return) > > - - - - - - - - - > > GC.start 1 (free) > -------------------------- ----------- -------- > > I wrote test cases for this case. > > -- > kimura wataru > <tc_retaincount.patch> > _______________________________________________ > Rubycocoa-devel mailing list > Rubyc****@lists***** > http://lists.sourceforge.jp/mailman/listinfo/rubycocoa-devel