[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-core
Subject:    patch
From:       "Roger Pack" <rogerpack2005 () gmail ! com>
Date:       2008-04-30 20:24:22
Message-ID: 966599840804301324r5a6d1870h883e8d41f0977cc0 () mail ! gmail ! com
[Download RAW message or body]


It said on the web site to throw ones patches this direction.

Here's one for a bug submitted [and fixed] about 6 months ago.  Guess
I forgot to submit the patch itself.
This is a fix for the following leaks:

def leak
 "name".split(/::/)
end

loop {leak} # leaks

def grow
 for i in 1..100
   eval "b#{i}=1"
 end
end
1500000.times {grow} # leaks
[this style of leak is reported on several web sites as a ruby leak, as well]

Ref:
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=15425&group_id=426

Reservations:
I just added this patch from someone else's post--I'm not positive
there aren't side-effects, though I haven't seen any.  I'm not scope
pro here :)
Also for some reason this worked on my Linux machine but not my mac
machine [still leaks].  Maybe because of my linking to some old
'legacy' libs or something.
Let me know what I can do to help it get accepted.
-R

PS Here's a copy in case the attachment doesn't get through.
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();

["unleak.diff" (application/octet-stream)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic