Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid all use of deepcopy #66

Merged
merged 1 commit into from
Feb 27, 2023
Merged

Avoid all use of deepcopy #66

merged 1 commit into from
Feb 27, 2023

Conversation

kbarros
Copy link
Member

@kbarros kbarros commented Feb 27, 2023

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 ordinary copy operations on mutable arrays. Hopefully resolves #65, originally reported in JuliaLang/julia#48722 .

Replace with custom clone functions that recurse datastructures and
perform ordinary `copy` on mutable arrays.
@kbarros kbarros merged commit a3e1d63 into main Feb 27, 2023
@kbarros kbarros deleted the nodeepcopy branch February 27, 2023 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Occasional segfaults when dipole-dipole interactions are enabled
1 participant