Skip to content

Commit

Permalink
Release mesh memory too
Browse files Browse the repository at this point in the history
  • Loading branch information
aulemahal committed Nov 20, 2024
1 parent 92142e4 commit d9e72f0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions xesmf/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1312,13 +1312,15 @@ def _compute_weights(self, grid_in, grid_out):

# Get weights for external polygons
w, area = self._compute_weights_and_area(grid_in, mesh_ext)
mesh_ext.destroy() # release mesh memory

# Get weights for interiors and append them to weights from exteriors as a negative contribution.
if len(interiors) > 0 and not self.ignore_holes:
mesh_int = Mesh.from_polygons(interiors)

# Get weights for interiors
w_int, area_int = self._compute_weights_and_area(grid_in, mesh_int)
mesh_int.destroy() # release mesh memory

# Append weights from holes as negative weights
# In sparse >= 0.16, a fill_value of -0.0 is different from 0.0 and the concat would fail
Expand Down

0 comments on commit d9e72f0

Please sign in to comment.