JLD.jl icon indicating copy to clipboard operation
JLD.jl copied to clipboard

stack overflow with circular references

Open CarloLucibello opened this issue 8 years ago • 0 comments
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

CarloLucibello avatar Jun 17 '17 09:06 CarloLucibello