From bd5dc649ad55fc4724cafad99852b825adfde182 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Thu, 12 Nov 2009 23:30:13 -0800 Subject: Possible workaround for #2824 (MRI GC bug) This is a moderately ugly workaround for the MRI garbage collection bug (see the ticket for details). I explored several other potential solutions (notably, monkey patching the routines that trigger the bug) but none of them were satisfactory. Monkey patching sub, gsub, sub!, gsub!, etc., for example, either changes the scoping of $~, $1, etc. in a way that could potentially subtly change the meaning of programs or (if you are clever) faithfully reproduces the behaviour of MRI--including the memory leak. I decided to go with the standardized and somewhat obnoxious never- used optional argument as it was easy to automatically insert and should be even easier to automatically find and remove if a better fix is developed. It also should be obtrusive enough to escape accidental removal in refactoring. --- lib/puppet/rails/resource.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/puppet/rails') diff --git a/lib/puppet/rails/resource.rb b/lib/puppet/rails/resource.rb index 12d321143..984bdc05a 100644 --- a/lib/puppet/rails/resource.rb +++ b/lib/puppet/rails/resource.rb @@ -199,7 +199,7 @@ class Puppet::Rails::Resource < ActiveRecord::Base result end - def ref + def ref(dummy_argument=:work_arround_for_ruby_GC_bug) "%s[%s]" % [self[:restype].split("::").collect { |s| s.capitalize }.join("::"), self.title.to_s] end -- cgit