From: Roger Pack Date: 2008-05-01T05:24:22+09:00 Subject: patch ------=_Part_5493_32152128.1209587062209 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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(); ------=_Part_5493_32152128.1209587062209 Content-Type: application/octet-stream; name=unleak.diff Content-Transfer-Encoding: base64 X-Attachment-Id: f_ffocoqdr0 Content-Disposition: attachment; filename=unleak.diff SW5kZXg6IHBhcnNlLnkKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gcGFyc2UueQkocmV2aXNpb24gMTYyNDQpCisr KyBwYXJzZS55CSh3b3JraW5nIGNvcHkpCkBAIC01ODIxLDcgKzU4MjEsOCBAQAogICAgICAgICAg ICAgICAgaWYgKCEocnVieV9zY29wZS0+ZmxhZ3MgJiBTQ09QRV9DTE9ORSkpCiAgICAgICAgICAg ICAgICAgICAgeGZyZWUocnVieV9zY29wZS0+bG9jYWxfdGJsKTsKIAkgICAgfQotCSAgICBydWJ5 X3Njb3BlLT5sb2NhbF90YmwgPSBsb2NhbF90YmwoKTsKKyAgICAgICAgICAgIHJ1Ynlfc2NvcGUt PmxvY2FsX3ZhcnNbLTFdID0gMDsKKyAgICAgICAgICAgIHJ1Ynlfc2NvcGUtPmxvY2FsX3RibCA9 IGxvY2FsX3RibCgpOwogCX0KICAgICB9CiAgICAgbG9jYWxfcG9wKCk7Cg== ------=_Part_5493_32152128.1209587062209--