JLD.jl
JLD.jl copied to clipboard
stack overflow with circular references
trafficstars
An example:
julia> type A; x::Any; end
julia> type B; a::A; end;
julia> a=A(0)
A(0)
julia> b=B(a)
B(A(0))
julia> a.x = b
B(A(B(#= circular reference @-2 =#)))
julia> save("a.jld", "a", a)
.... LONG STACK OVERFLOW ERROR ....
Maybe it should not be too difficult to prune circular references in save (one could have a look at Base.show for inspiration). Correctly loading the object should be a much more difficult problem though.
Bye, Carlo