From: Eric Mahurin Date: 2005-10-06T01:02:54+09:00 Subject: Re: Concerning shared flag Not sure if you are aware or not, there are some serious performance (run-time and memory) issues with element sharing in the current ruby. Try any method that takes a small slice of a large array and then later (even after the small slice is GCed) modify the large array. The modify will cause a copy of the large array and the small slice will continue to reference the original large array. You can see how this could cause serious run-time and memory penalties. I've done a patch to fix this plus do other speedups. See the thread "another array patch - massive performance boosts". I'd suggest you not do element sharing in your custom class until this is resolved. I agree that it would be nice if the GC was more generalized to let the class handle these special cases (element sharing) instead of embedding this code in gc.c. --- Christophe Poucet wrote: > Hello, > > I'm trying to build an object that behaves just like Array in > c. However > there seems to be one stumbling block. I looked at the > garbage collector and > there is no special case in T_DATA in case an object has the > flag shared. I > think there should be two different marking functions in case > an object has > the set and in the case it does not. That way I could design > something like > this: > struct RVarArrayData { > long len; > union { > long capa; > VALUE shared; > } aux; > VARVALUE * ptr; > }; > > However at the moment this is not a possibility. > > With regards, > Christophe > __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com