Project

General

Profile

Actions

Bug #10368

closed

GC mark miss on bindings

Added by ktsj (Kazuki Tsujimoto) over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 2.2.0dev (2014-10-11 trunk 47881) [x86_64-linux]
[ruby-dev:48616]

Description

以下のコードでSEGVすることがあります。
mに渡したブロックがGCされてしまうのが原因です。

def m
  binding
end

GC.stress = true
b = nil
tap do 
  b = m {}
end
GC.start
0.times.to_a
b.eval('yield')

ブロックに対応するProcオブジェクトをrb_binding_tに持たせるようにするパッチを添付します。


Files

Updated by ktsj (Kazuki Tsujimoto) over 7 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

Applied in changeset r48000.


  • vm_core.h, vm.c, proc.c: fix GC mark miss on bindings.
    [ruby-dev:48616] [Bug #10368]

  • test/ruby/test_eval.rb: add a test code.

Updated by nagachika (Tomoyuki Chikanaga) over 7 years ago

  • Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED to 2.0.0: REQUIRED, 2.1: DONE

Backported into ruby_2_1 at r48004.

Updated by usa (Usaku NAKAMURA) over 7 years ago

  • Backport changed from 2.0.0: REQUIRED, 2.1: DONE to 2.0.0: DONE, 2.1: DONE

Backported into ruby_2_0_0 at r48048.

Actions

Also available in: Atom PDF