Skip to content

Commit

Permalink
Merge pull request #4167 from meeseeksmachine/auto-backport-of-pr-416…
Browse files Browse the repository at this point in the history
…4-on-yt-4.1.x

Backport PR #4164 on branch yt-4.1.x ([BUGFIX] Memory leak: free C++ memory before deallocing Python object)
  • Loading branch information
neutrinoceros authored Oct 14, 2022
2 parents 151528d + a1cf039 commit d69f889
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions yt/geometry/oct_container.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,11 @@ cdef class SparseOctreeContainer(OctreeContainer):
def __dealloc__(self):
# This gets called BEFORE the superclass deallocation. But, both get
# called.
cdef OctKey *ikey
for i in range(self.num_root):
ikey = &self.root_nodes[i]
tdelete(<void *>ikey, &self.tree_root, root_node_compare)

if self.root_nodes != NULL: free(self.root_nodes)

cdef class ARTOctreeContainer(OctreeContainer):
Expand Down

0 comments on commit d69f889

Please sign in to comment.