[Q] YAML Error: stack level too deep

  • Thread starter E.-R. Bruecklmeier
  • Start date
E

E.-R. Bruecklmeier

Hi Rubyists,

is there a solution for the:

`quick_emit': stack level too deep (SystemStackError)

Error?

OS: Win98
Ruby: 1.8.1

The whole error message:

C:/RUBY SYSTEM/RUBY180/lib/ruby/1.8/yaml.rb:188:in `quick_emit': stack
level too deep (SystemStackError)
from C:/RUBY SYSTEM/RUBY180/lib/ruby/1.8/yaml/rubytypes.rb:213:in `to_yaml'
from C:/RUBY SYSTEM/RUBY180/lib/ruby/1.8/yaml/baseemitter.rb:175:in `map'
from C:/RUBY SYSTEM/RUBY180/lib/ruby/1.8/yaml/baseemitter.rb:164:in `each'
from C:/RUBY SYSTEM/RUBY180/lib/ruby/1.8/yaml/baseemitter.rb:164:in `map'
from C:/RUBY SYSTEM/RUBY180/lib/ruby/1.8/yaml/rubytypes.rb:24:in `to_yaml'
from C:/RUBY SYSTEM/RUBY180/lib/ruby/1.8/yaml/rubytypes.rb:23:in `call'
from C:/RUBY SYSTEM/RUBY180/lib/ruby/1.8/yaml.rb:188:in `quick_emit'
from C:/RUBY SYSTEM/RUBY180/lib/ruby/1.8/yaml/rubytypes.rb:23:in `to_yaml'
... 1145 levels...
from C:/RUBY SYSTEM/RUBY180/lib/ruby/1.8/yaml/rubytypes.rb:23:in `call'
from C:/RUBY SYSTEM/RUBY180/lib/ruby/1.8/yaml.rb:188:in `quick_emit'
from C:/RUBY SYSTEM/RUBY180/lib/ruby/1.8/yaml/rubytypes.rb:23:in `to_yaml'
from X:/Diss/Programme/Test_netgen/rbF034.TMP:43
 
A

Anders Bengtsson

--- "E.-R. Bruecklmeier said:
Hi Rubyists,

is there a solution for the:

`quick_emit': stack level too deep (SystemStackError)

Error?

You're probably writing a very deep object graph, which uses up all the
stack.
One solution could be to write custom YAML emitters for some of your
classes, that writes the data in a more "flat" form (writing a tree of
objects as a list, etc.)
Look in the YAML source for how Ruby's built-in types are written to
YAML.

/Anders


=====
__________________________________________________
Anders Bengtsson (e-mail address removed)
Stockholm, Sweden

Höstrusk och grå moln - köp en resa till solen på Yahoo! Resor på adressen http://se.docs.yahoo.com/travel/index.html
 
E

E.-R. Bruecklmeier

Anders said:
You're probably writing a very deep object graph, which uses up all the
stack.
One solution could be to write custom YAML emitters for some of your
classes, that writes the data in a more "flat" form (writing a tree of
objects as a list, etc.)
Look in the YAML source for how Ruby's built-in types are written to
YAML.

Thank you, for the quick answer. But i don't want to go deeper in this
matter, i'm just looking for a quick and dirty method to serialize large
objects in a readable manner.

Eric.
 
A

Anders Bengtsson

Thank you, for the quick answer. But i don't want to go deeper in
this
matter, i'm just looking for a quick and dirty method to serialize
large
objects in a readable manner.

I guess readability could be a problem, but you could attempt to
flatten the object graph even before attempting to serialize it. If you
have things like linked-lists you convert them to plain arrays, etc.
Or maybe you can increase the stack size in some way? (I don't know how
that's done in Windows).

/Anders


=====
__________________________________________________
Anders Bengtsson (e-mail address removed)
Stockholm, Sweden

Höstrusk och grå moln - köp en resa till solen på Yahoo! Resor på adressen http://se.docs.yahoo.com/travel/index.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top