[yt-svn] commit/yt-3.0: MatthewTurk: Free positions when finalizing the particle octrees

Bitbucket commits-noreply at bitbucket.org
Sat Aug 18 16:20:20 PDT 2012


1 new commit in yt-3.0:


https://bitbucket.org/yt_analysis/yt-3.0/changeset/c58b01ee9a6d/
changeset:   c58b01ee9a6d
branch:      yt-3.0
user:        MatthewTurk
date:        2012-08-18 16:33:26
summary:     Free positions when finalizing the particle octrees
affected #:  1 file

diff -r 75213d5a0d9bc735a3cac30006692155825298ba -r c58b01ee9a6d42d167ed61092dcf720efd34b59e yt/geometry/oct_container.pyx
--- a/yt/geometry/oct_container.pyx
+++ b/yt/geometry/oct_container.pyx
@@ -437,10 +437,11 @@
                     if o.children[i][j][k] == NULL: continue
                     self.visit_free(o.children[i][j][k])
         if o.sd.np >= 0:
-            for i in range(3):
-                free(o.sd.pos[i])
+            if o.sd.pos != NULL:
+                for i in range(3):
+                    free(o.sd.pos[i])
+                free(o.sd.pos)
             free(o.sd.domain_id)
-            free(o.sd.pos)
         free(o)
 
     def allocate_domains(self, domain_counts):
@@ -452,6 +453,12 @@
         cdef ParticleArrays *c = self.first_sd
         while c != NULL:
             self.oct_list[i] = c.oct
+            if c.np >= 0:
+                for j in range(3):
+                    free(c.pos[j])
+                free(c.pos)
+                c.pos = NULL
+                # We should also include a shortening of the domain IDs here
             c = c.next
             i += 1

Repository URL: https://bitbucket.org/yt_analysis/yt-3.0/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list