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

Fix dft fields memory leak #1264

Closed
wants to merge 3 commits into from
Closed

Conversation

smartalecH
Copy link
Collaborator

Fixes #1262

Fixes three issues currently found in the _get_dft_array routine.

  1. Initializes the dimension object dim. 2D simulations don't set the third dimension by default, consequently whatever garbage is in memory becomes the third dimension. This is obviously problematic when creating a python array from the dimension object.
  2. When a dft array is requested from a component that isn't stored due to symmetry, source specifications, etc, the routine used to return a python array size 0. Python doesn't like this, and produces an array size 1 with whatever garbage is in memory there. Now, the routine returns an array with a size of 1 and with a complex 0. This is especially important for adjoint calculations, which need to store all field components and don't have knowledge about which components meep is actually calculating. The current adjoint toolbox will already broadcast the 0 accordingly.
  3. I am now using PyArray_SimpleNewFromData to create and copy the array data.

python/meep.i Outdated Show resolved Hide resolved
python/meep.i Outdated Show resolved Hide resolved
@smartalecH
Copy link
Collaborator Author

Implemented in #1242.

@smartalecH smartalecH closed this Jul 1, 2020
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.

Non-reproducible outputs from adjoint solver (memory leak?)
2 participants