> def quit_excel(xl) > xl.quit > xl = nil > GC.start > end > > As you know, the argument is call-by-value and even if I set nil to xl, the > outer reference is still referencing Excel. > So GC won't collect it. > > How can I solve this problem? Interesting problem :) You have to 'disconnect' the parameter in the function from the variable you want to change. As the parameter you could just use a string with the name of your variable. Then you'd have something like this: def quit_excel(name_var) eval("#{name_var}.quit") eval("#{name_var} = nil") GC.start end Ruben