------art_84930_4885925.1165602104798
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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  playTree.new
100000.times {|i| t[i]  }
Marshal::dump t


Thanks for any help,
Emmett

------art_84930_4885925.1165602104798
Content-Type: application/octet-stream; name=splay.rb
Content-Transfer-Encoding: base64
X-Attachment-Id: f_evgx8h5z
Content-Disposition: attachment; filename="splay.rb"

Y2xhc3MgU3BsYXlOb2RlCiAgYXR0cl9hY2Nlc3NvciA6a2V5LCA6dmFsLCA6bGVmdCwgOnJpZ2h0
CiAgZGVmIGluaXRpYWxpemUoa2V5LCB2YWwpCiAgICBAa2V5ID0ga2V5CiAgICBAdmFsID0gdmFs
CiAgZW5kCgogIGRlZiB0b19zKGRlcHRoPTAsIHZhbHVlcz1bXSkKICAgIHZhbHVlcyA8PCAiI3tB
cnJheS5uZXcoZGVwdGgsICcgJyl9I3trZXl9LCAje3ZhbH0iCiAgICB2YWx1ZXMgPDwgIjoiIGlm
IGxlZnQgb3IgcmlnaHQKICAgIHZhbHVlcyA8PCAiXG4iCiAgICBsZWZ0LnRvX3MoZGVwdGgrMSwg
dmFsdWVzKSBpZiBsZWZ0CiAgICByaWdodC50b19zKGRlcHRoKzEsIHZhbHVlcykgaWYgcmlnaHQK
ICAgIHZhbHVlcy5qb2luCiAgZW5kCmVuZAoKY2xhc3MgU3BsYXlUcmVlCiAgYXR0cl9hY2Nlc3Nv
ciA6cm9vdAoKICBkZWYgaGVhZGVyCiAgICBAaGVhZGVyIHx8PSBTcGxheU5vZGUubmV3KG5pbCwg
bmlsKQogIGVuZAoKICBkZWYgdG9fcwogICAgQHJvb3QudG9fcwogIGVuZAoKICBkZWYgW10oa2V5
KQogICAgaWYga2V5LmlzX2E/IFJhbmdlCiAgICAgIHJhbmdlKGtleSkKICAgIGVsc2UKICAgICAg
ZmluZChrZXkpCiAgICBlbmQKICBlbmQKCiAgZGVmIFtdPShrZXksIHZhbCkKICAgIGluc2VydChr
ZXksIHZhbCkKICBlbmQKCiAgZGVmIGluc2VydChrZXksIHZhbCkKICAgIHVubGVzcyBAcm9vdAog
ICAgICBAcm9vdCA9IFNwbGF5Tm9kZS5uZXcoa2V5LCB2YWwpCiAgICAgIHJldHVybgogICAgZW5k
CiAgICAKICAgIHNwbGF5KGtleSkKICAgIAogICAgaWYgQHJvb3Qua2V5ID09IGtleQogICAgICBA
cm9vdC52YWwgPSB2YWwKICAgICAgcmV0dXJuCiAgICBlbmQKCiAgICBuID0gU3BsYXlOb2RlLm5l
dyhrZXksIHZhbCkKICAgIGlmIGtleSA8IEByb290LmtleQoJICAgIG4ubGVmdCA9IEByb290Lmxl
ZnQKCSAgICBuLnJpZ2h0ID0gQHJvb3QKCSAgICBAcm9vdC5sZWZ0ID0gbmlsCiAgICBlbHNlCiAg
ICAgIG4ucmlnaHQgPSBAcm9vdC5yaWdodAogICAgICBuLmxlZnQgPSBAcm9vdAogICAgICBAcm9v
dC5yaWdodCA9IG5pbAogICAgZW5kCiAgICBAcm9vdCA9IG4KICBlbmQKICAgICAgCiAgZGVmIHJl
bW92ZShrZXkpCiAgICBzcGxheShrZXkpCgogICAgaWYga2V5ICE9IEByb290LmtleQogICAgICBy
YWlzZSAiI3trZXl9IG5vdCBmb3VuZCBpbiB0cmVlIgogICAgZW5kCgogICAgdW5sZXNzIEByb290
LmxlZnQgCiAgICAgIEByb290ID0gQHJvb3QucmlnaHQKICAgIGVsc2UgCgkgICAgeCA9IEByb290
LnJpZ2h0CgkgICAgQHJvb3QgPSB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gICAgIHQucmlnaHQgPSB5LmxlZnQKICAgICAg
ICAgIHkubGVmdCA9IHQKICAgICAgICAgIHQgPSB5CiAgICAgICAgICBicmVhayB1bmxlc3MgdC5y
aWdodAogICAgICAgIGVuZAogICAgICAgIGwucmlnaHQgPSB0CiAgICAgICAgbCA9IHQKICAgICAg
ICB0ID0gdC5yaWdodAogICAgICBlbHNlCiAgICAgICAgYnJlYWsKCSAgICBlbmQKICAgIGVuZAog
ICAgbC5yaWdodCA9IHQubGVmdAogICAgci5sZWZ0ID0gdC5yaWdodAogICAgdC5sZWZ0ID0gaGVh
ZGVyLnJpZ2h0CiAgICB0LnJpZ2h0ID0gaGVhZGVyLmxlZnQKICAgIEByb290ID0gdAogIGVuZAoK
ZW5kCg------art_84930_4885925.1165602104798--