# Eval("", TOPLEVEL\_BINDING) and ObjectSpace.\_id2ref

**URL:** <https://www.ruby-forum.com/t/eval-toplevel-binding-and-objectspace-id2ref/115904>\
**Category:** Development\
**Created:** [September 30, 2007, 4:23am UTC](https://www.ruby-forum.com/t/eval-toplevel-binding-and-objectspace-id2ref/115904 "2007-09-30T04:23:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tanaka\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c67d28/32.png) [@Tanaka\_A](https://www.ruby-forum.com/u/Tanaka_A)\
**Post date:** [September 30, 2007, 4:23am UTC](https://www.ruby-forum.com/t/eval-toplevel-binding-and-objectspace-id2ref/115904/1 "2007-09-30T04:23:20Z")

</div>

e$B0J2\<$N$h$&$K$9$k$He(B SEGV e$B$7$^$9!#e(B

## % ./ruby -e ’ eval("", TOPLEVEL\_BINDING) minobj = ObjectSpace.to\_enum(:each\_object).min {|a,b| a.object\_id \<=\> b.object\_id } maxobj = ObjectSpace.to\_enum(:each\_object).max {|a,b| a.object\_id \<=\> b.object\_id } minobj.object\_id.upto(maxobj.object\_id) {|id| begin o = ObjectSpace.\_id2ref(id) rescue RangeError next end o.inspect } ’ -e:11: – control frame ---------- c:0006 p:0031 s:0017 b:0016 l:000006 d:000015 BLOCK -e:11 c:0005 p:---- s:0014 b:0013 l:000012 d:000012 FINISH :each c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :upto c:0003 p:0085 s:0007 b:0007 l:000006 d:000006 TOP -e:5 c:0002 p:---- s:0003 b:0003 l:000002 d:000002 FINISH :inherited c:0001 p:---- s:0001 b:-001 l:000000 d:000000 ------

DBG\> : “-e:5:in `upto'" DBG> : "-e:5:in`'”  
– backtrace of native function call (Use addr2line) –  
0x80e0fc5  
0x80fcaf3  
0x80fcbbb  
0x80b3ad0  
0xb7f4b420  
0x8057df4  
0x8057e43  
0x8057f1c  
0x80dece5  
0x80df894  
0x80d8a85  
0x805a1de  
0x80723cf  
0x80d9576  
0x80dc1bc  
0x80df894  
0x80dfbcb  
0x8059b09  
0x805d40d  
0x80577b0  
0xb7db5ea8  
0x80576d1
