[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Marshal::dump error on PowerBook G4

Eric Hodel

12/9/2006 12:53:00 AM

On Dec 8, 2006, at 10:21 , Emmett Shear wrote:

> I've written code for a Splay tree in Ruby, and I'm trying to
> serialize it using Marshal::dump.
>
> If I create a tree with 1,000 or 10,000 nodes, Marshal::dump works
> perfectly. When I get up to 100,000 nodes, Marshal::dump causes the
> irb process to die with the error "Illegal Instruction".
>
> Is this a known problem? I tried searching for "Marshal::dump" and
> "Illegal Instruction" it but I didn't turn up anything. I'm on a
> PowerBook G4, running Ruby version 1.8.5 and IRb version 0.9.5. I've
> attached the code for the Splay tree; to reproduce, open irb and run:
>
> require 'splay'
> t = SplayTree.new
> 100000.times {|i| t[i] = i}
> Marshal::dump t

I think you ran out of something because your C stack is huge.

(gdb) run splay.rb
Starting program: /usr/local/bin/ruby splay.rb
Reading symbols for shared libraries .. done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0xbf7fffc0
0x00064bbc in str_independent (str=1854980) at string.c:474
474 {
(gdb) bt
#0 0x00064bbc in str_independent (str=1854980) at string.c:474
#1 0x00064d34 in rb_str_modify (str=1854980) at string.c:505
#2 0x0006540c in rb_str_buf_cat (str=1854980, ptr=0xbf800178 "\b??
T", len=1) at string.c:706
#3 0x0008bf28 in w_nbyte (s=0x64d34 "/?", n=1, arg=0xbfffe854) at
marshal.c:128
#4 0x0008bfb4 in w_byte (c=8 '\b', arg=0x1) at marshal.c:141
#5 0x0008c088 in w_long (x=1, arg=0xbfffe854) at marshal.c:183
#6 0x0008c5b8 in w_symbol (id=10154, arg=0xbfffe854) at marshal.c:336
#7 0x0008c9b8 in w_obj_each (id=1854980, value=171689,
arg=0xbf800428) at marshal.c:428
#8 0x00056394 in foreach_safe_i (key=412980, value=3212837240,
arg=0x1) at hash.c:131
#9 0x0007756c in st_foreach (table=0x2b9c200, func=0x56360
<foreach_safe_i>, arg=3212837752) at st.c:487
#10 0x000563e4 in st_foreach_safe (table=0x1c4e04, func=0xbf800178,
a=1) at hash.c:149
#11 0x0008ca24 in w_ivar (tbl=0x2b9c200, arg=0xbf800428) at marshal.c:
440
#12 0x0008d160 in w_object (obj=23661220, arg=0xbfffe854, limit=1) at
marshal.c:648
#13 0x0008c9c8 in w_obj_each (id=1854980, value=23661220,
arg=0xbf800678) at marshal.c:429
#14 0x00056394 in foreach_safe_i (key=412980, value=3212837240,
arg=0x1) at hash.c:131
...

I gave up at:

#3525 0x0007756c in st_foreach (table=0x2bae700, func=0x56360
<foreach_safe_i>, arg=3213184664) at st.c:487

--
Eric Hodel - drbrain@segment7.net - http://blog.se...

I LIT YOUR GEM ON FIRE!