From: ts Date: 2004-09-13T23:51:23+09:00 Subject: Re: [PATCH] dir.c --- Dir.chdir error handling >>>>> "H" == H Yamamoto writes: H> And move to func2, func3.... mostly object will be protected with volatile or H> touched with OBJ_INFECT() or StringValue() somewhere, but there is possibility H> none of the functions won't protect it. I think [ruby-dev:19854] is such bug. Well, not really : in [ruby-dev:19854] there is a problem because `args' was in a register, ruby has stored a new value in it and then removed the object from the register to make the call to method_call() (probably replaced with RARRAY(args)->ptr) When ruby call the GC (in method_call()) it will not mark `args' and it will free RARRAY(args)->ptr which is used by method_call() The effect of volatile in this case is to put `args2' in the stack, this will give the possibility to ruby to mark it. In your example, you constantly work with an object `v' and not the content of the object, like RARRAY(v)->ptr. This mean that this object `v' will be in a register or in the stack (ruby need it) and it will marked by the GC Guy Decoux