Leak stuff

Has anything being done on these?

def leak
“name”.split(/::/)
end

loop {leak} # leaks

loop do
rand(10000000).to_s.to_sym # leaks
end

?
-R

On Apr 29, 2008, at 1:12 PM, Roger P. wrote:

Has anything being done on these?

def leak
“name”.split(/::/)
end

loop {leak} # leaks

To answer my own question.
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=15425&group_id=426
It appears to still be a leak in Ruby, though fixed. It occurs
whenever you have a regexp replace [?] within a function with no
variables, or something like that.

loop do
rand(10000000).to_s.to_sym # leaks
end
This one is also still in Ruby, I believe.

Roger P. wrote:

loop do
rand(10000000).to_s.to_sym # leaks
end
This one is also still in Ruby, I believe.

Not a leak. Symbols are not collectable.

On Wed, 30 Apr 2008 05:16:34 +0900, Joel VanderWerf
[email protected] wrote:

Roger P. wrote:

loop do
rand(10000000).to_s.to_sym # leaks
end
This one is also still in Ruby, I believe.

Not a leak. Symbols are not collectable.

It depends on the Ruby implementation.

-mental

MenTaLguY wrote:

On Wed, 30 Apr 2008 05:16:34 +0900, Joel VanderWerf [email protected] wrote:

Roger P. wrote:

loop do
rand(10000000).to_s.to_sym # leaks
end
This one is also still in Ruby, I believe.
Not a leak. Symbols are not collectable.

It depends on the Ruby implementation.

Is that changing in MRI?

def leak
“name”.split(/::/)
end

loop {leak} # leaks

This leaks too. Not sure if it’s related or not.

def grow
for i in 1…100
eval “b#{i}=1”
end
end
15000.times {grow}

from http://pennysmalls.com/

This leaks too. Not sure if it’s related or not.

def grow
for i in 1…100
eval “b#{i}=1”
end
end
15000000.times {grow}
Appears that it was the same bug.
Attached is a patch which works at least on linux, but not on mac os
[for some
reason–maybe mine dynamically links to an old copy or something].
-R

Index: parse.y

— parse.y (revision 16244)
+++ parse.y (working copy)
@@ -5821,7 +5821,8 @@
if (!(ruby_scope->flags & SCOPE_CLONE))
xfree(ruby_scope->local_tbl);
}

  •       ruby_scope->local_tbl = local_tbl();
    
  •        ruby_scope->local_vars[-1] = 0;
    
  •        ruby_scope->local_tbl = local_tbl();
      }
    
    }
    local_pop();

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs