Julia developers Gabriel Baraldi and Jameson Nash pointed out that the use of deepcopy can be memory unsafe, especially when used in combination with C datastructures. It appears this was the source of intermittent segfault behavior observed when calling FFTW. (Perhaps the problem was deep-copying an FFTW plan, or perhaps it was some other memory corruption.)
Julia developers Gabriel Baraldi and Jameson Nash pointed out that the use of
deepcopy
can be memory unsafe, especially when used in combination with C datastructures. It appears this was the source of intermittent segfault behavior observed when calling FFTW. (Perhaps the problem was deep-copying an FFTW plan, or perhaps it was some other memory corruption.)This PR replaces all calls to
deepcopy
with custom clone functions that perform ordinarycopy
operations on mutable arrays. Hopefully resolves https://github.com/SunnySuite/Sunny.jl/issues/65, originally reported in https://github.com/JuliaLang/julia/issues/48722 .