R
Ronny Voelker
Hi,
i have a script which scans source code files for source code items
(like methods) and cross references between them, and another script
which displays the scanned references.
The references are stored in ruby as web of objects.
Script 1 saves the objects into a file using Marshal.dump and script 2
loads the file using Marshal.load.
If the scanned source code gets more complex and the dumped file gets
larger, Script 2 fails with 'SystemStackError: stack level too deep'
in Marshal.load.
Normaly i'm using ruby 1.8.1 (2004-01-27) [i386-mswin32].
With this ruby version i get the SystemStackError with my scanned
source code.
I have also tried ruby 1.8.1 (2003-12-25) [i386-cygwin].
Here i was able to load the dump file which failed with the mswin
ruby.
It was even possible to load much larger and more complex dumps.
How can i make my skripts work with mswin ruby?
Increase the Stack size? How?
Cygwin ruby is not an option for me.
Here is a pice of code which (i think) reproduces the problem:
class C
def initialize( t )
@t = t
end
end
def a(range)
x = nil
(1..range).each do
x = C.new( x )
end
puts "created"
y = Marshal.dump(x)
puts "dumped " + y.length.to_s
z = Marshal.load(y)
puts "loaded"
end
If i call a(8000) in mswin ruby i get the Stack error.
In cygwin ruby it is possibel to call a(150000) without an error.
When calling a(200000) in cygwin ruby, it crashes in Marshal.dump
without a notice.
thanks in advance
Ronny
i have a script which scans source code files for source code items
(like methods) and cross references between them, and another script
which displays the scanned references.
The references are stored in ruby as web of objects.
Script 1 saves the objects into a file using Marshal.dump and script 2
loads the file using Marshal.load.
If the scanned source code gets more complex and the dumped file gets
larger, Script 2 fails with 'SystemStackError: stack level too deep'
in Marshal.load.
Normaly i'm using ruby 1.8.1 (2004-01-27) [i386-mswin32].
With this ruby version i get the SystemStackError with my scanned
source code.
I have also tried ruby 1.8.1 (2003-12-25) [i386-cygwin].
Here i was able to load the dump file which failed with the mswin
ruby.
It was even possible to load much larger and more complex dumps.
How can i make my skripts work with mswin ruby?
Increase the Stack size? How?
Cygwin ruby is not an option for me.
Here is a pice of code which (i think) reproduces the problem:
class C
def initialize( t )
@t = t
end
end
def a(range)
x = nil
(1..range).each do
x = C.new( x )
end
puts "created"
y = Marshal.dump(x)
puts "dumped " + y.length.to_s
z = Marshal.load(y)
puts "loaded"
end
If i call a(8000) in mswin ruby i get the Stack error.
In cygwin ruby it is possibel to call a(150000) without an error.
When calling a(200000) in cygwin ruby, it crashes in Marshal.dump
without a notice.
thanks in advance
Ronny