I'd love to see someone with memory problems try this out and see how  
much of an impact it has.

Maybe put this in the testing branch for a while?

On Nov 17, 2009, at 12:45 AM, Markus Roberts wrote:

>
> 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.
>
> Signed-off-by: Markus Roberts <mar...@reality.com>
> ---
> lib/puppet/application/puppetdoc.rb        |    2 +-
> lib/puppet/file_serving/base.rb            |    2 +-
> lib/puppet/indirector/node/ldap.rb         |    2 +-
> lib/puppet/parser/ast/leaf.rb              |    2 +-
> lib/puppet/provider/service/daemontools.rb |    2 +-
> lib/puppet/provider/service/runit.rb       |    2 +-
> lib/puppet/provider/zone/solaris.rb        |    2 +-
> lib/puppet/rails/resource.rb               |    2 +-
> lib/puppet/sslcertificates/ca.rb           |    4 ++--
> lib/puppet/type/k5login.rb                 |    2 +-
> lib/puppet/util/subclass_loader.rb         |    2 +-
> 11 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/lib/puppet/application/puppetdoc.rb b/lib/puppet/ 
> application/puppetdoc.rb
> index 5656112..0a4e0c3 100644
> --- a/lib/puppet/application/puppetdoc.rb
> +++ b/lib/puppet/application/puppetdoc.rb
> @@ -192,7 +192,7 @@ Puppet::Application.new(:puppetdoc) do
>         end
>     end
>
> -    def setup_rdoc
> +    def setup_rdoc(dummy_argument=:work_arround_for_ruby_GC_bug)
>         # consume the unknown options
>         # and feed them as settings
>         if @unknown_args.size > 0
> diff --git a/lib/puppet/file_serving/base.rb b/lib/puppet/ 
> file_serving/base.rb
> index 02132e8..a7ab9b6 100644
> --- a/lib/puppet/file_serving/base.rb
> +++ b/lib/puppet/file_serving/base.rb
> @@ -22,7 +22,7 @@ class Puppet::FileServing::Base
>     end
>
>     # Return the full path to our file.  Fails if there's no path set.
> -    def full_path
> +    def full_path(dummy_argument=:work_arround_for_ruby_GC_bug)
>         (if relative_path.nil? or relative_path == "" or  
> relative_path == "."
>             path
>         else
> diff --git a/lib/puppet/indirector/node/ldap.rb b/lib/puppet/ 
> indirector/node/ldap.rb
> index 4600a0d..dd8cebf 100644
> --- a/lib/puppet/indirector/node/ldap.rb
> +++ b/lib/puppet/indirector/node/ldap.rb
> @@ -73,7 +73,7 @@ class Puppet::Node::Ldap < Puppet::Indirector::Ldap
>
>     # The attributes that Puppet will stack as array over the full
>     # hierarchy.
> -    def stacked_attributes
> +    def  
> stacked_attributes(dummy_argument=:work_arround_for_ruby_GC_bug)
>         Puppet[:ldapstackedattrs].split(/\s*,\s*/)
>     end
>
> diff --git a/lib/puppet/parser/ast/leaf.rb b/lib/puppet/parser/ast/ 
> leaf.rb
> index b73c781..c8ac6f7 100644
> --- a/lib/puppet/parser/ast/leaf.rb
> +++ b/lib/puppet/parser/ast/leaf.rb
> @@ -101,7 +101,7 @@ class Puppet::Parser::AST
>             end
>         end
>
> -        def to_classname
> +        def  
> to_classname(dummy_argument=:work_arround_for_ruby_GC_bug)
>             to_s.downcase.gsub(/[^-\w:.]/,'').sub(/^\.+/,'')
>         end
>
> diff --git a/lib/puppet/provider/service/daemontools.rb b/lib/puppet/ 
> provider/service/daemontools.rb
> index 2c6c6db..3749f9c 100644
> --- a/lib/puppet/provider/service/daemontools.rb
> +++ b/lib/puppet/provider/service/daemontools.rb
> @@ -45,7 +45,7 @@  
> Puppet::Type.type(:service).provide :daemontools, :parent => :base do
>         attr_writer :defpath
>
>         # Determine the daemon path.
> -        def defpath
> +        def defpath(dummy_argument=:work_arround_for_ruby_GC_bug)
>             unless defined?(@defpath) and @defpath
>                 ["/var/lib/service", "/etc"].each do |path|
>                     if FileTest.exist?(path)
> diff --git a/lib/puppet/provider/service/runit.rb b/lib/puppet/ 
> provider/service/runit.rb
> index b313fc7..b8b444e 100644
> --- a/lib/puppet/provider/service/runit.rb
> +++ b/lib/puppet/provider/service/runit.rb
> @@ -38,7 +38,7 @@  
> Puppet::Type.type(:service).provide :runit, :parent => :daemontools do
>     class << self
>         # this is necessary to autodetect a valid resource
>         # default path, since there is no standard for such directory.
> -        def defpath
> +        def defpath(dummy_argument=:work_arround_for_ruby_GC_bug)
>             unless defined?(@defpath) and @defpath
>                 ["/etc/sv", "/var/lib/service"].each do |path|
>                     if FileTest.exist?(path)
> diff --git a/lib/puppet/provider/zone/solaris.rb b/lib/puppet/ 
> provider/zone/solaris.rb
> index 52007bb..b047f69 100644
> --- a/lib/puppet/provider/zone/solaris.rb
> +++ b/lib/puppet/provider/zone/solaris.rb
> @@ -64,7 +64,7 @@ Puppet::Type.type(:zone).provide(:solaris) do
>         @property_hash.clear
>     end
>
> -    def install
> +    def install(dummy_argument=:work_arround_for_ruby_GC_bug)
>         if @resource[:install_args]
>             zoneadm :install, @resource[:install_args].split(" ")
>         else
> diff --git a/lib/puppet/rails/resource.rb b/lib/puppet/rails/ 
> resource.rb
> index 12d3211..984bdc0 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
>
> diff --git a/lib/puppet/sslcertificates/ca.rb b/lib/puppet/ 
> sslcertificates/ca.rb
> index b5a2469..f6bcbc1 100644
> --- a/lib/puppet/sslcertificates/ca.rb
> +++ b/lib/puppet/sslcertificates/ca.rb
> @@ -134,7 +134,7 @@ class Puppet::SSLCertificates::CA
>
>     # List certificates waiting to be signed.  This returns a list  
> of hostnames, not actual
>     # files -- the names can be converted to full paths with  
> host2csrfile.
> -    def list
> +    def list(dummy_argument=:work_arround_for_ruby_GC_bug)
>         return Dir.entries(Puppet[:csrdir]).find_all { |file|
>             file =~ /\.pem$/
>         }.collect { |file|
> @@ -144,7 +144,7 @@ class Puppet::SSLCertificates::CA
>
>     # List signed certificates.  This returns a list of hostnames,  
> not actual
>     # files -- the names can be converted to full paths with  
> host2csrfile.
> -    def list_signed
> +    def list_signed(dummy_argument=:work_arround_for_ruby_GC_bug)
>         return Dir.entries(Puppet[:signeddir]).find_all { |file|
>             file =~ /\.pem$/
>         }.collect { |file|
> diff --git a/lib/puppet/type/k5login.rb b/lib/puppet/type/k5login.rb
> index 20c0324..5526fda 100644
> --- a/lib/puppet/type/k5login.rb
> +++ b/lib/puppet/type/k5login.rb
> @@ -56,7 +56,7 @@ Puppet::Type.newtype(:k5login) do
>         end
>
>         # Return the principals
> -        def principals
> +        def principals(dummy_argument=:work_arround_for_ruby_GC_bug)
>             if File.exists?(@resource[:name])
>                 File.readlines(@resource[:name]).collect { |line|  
> line.chomp }
>             else
> diff --git a/lib/puppet/util/subclass_loader.rb b/lib/puppet/util/ 
> subclass_loader.rb
> index 8776e85..b71ec72 100644
> --- a/lib/puppet/util/subclass_loader.rb
> +++ b/lib/puppet/util/subclass_loader.rb
> @@ -72,7 +72,7 @@ module Puppet::Util::SubclassLoader
>     end
>
>     # Retrieve or calculate a name.
> -    def name
> +    def name(dummy_argument=:work_arround_for_ruby_GC_bug)
>         unless defined? @name
>             @name = self.to_s.sub(/.+::/, '').intern
>         end
> -- 
> 1.6.4
>
>
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google  
> Groups "Puppet Developers" group.
> To post to this group, send email to puppet-dev@googlegroups.com
> To unsubscribe from this group, send email to 
> puppet-dev+unsubscr...@googlegroups.com
> For more options, visit this group at 
> http://groups.google.com/group/puppet-dev?hl=en
> -~----------~----~----~----~------~----~------~--~---
>


-- 
Barrow's first law:
     Any Universe simple enough to be understood is too simple to  
produce
     a mind able to understand it.
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com

--

You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to puppet-...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=.


Reply via email to