Changeset 4668


Ignore:
Timestamp:
Aug 10, 2007, 3:16:01 PM (17 years ago)
Author:
duncan
Message:

ticket#189 - hacky fix to unproven memory leak

Location:
anuga_core/source/anuga
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/alpha_shape/alpha_shape.py

    r4663 r4668  
    225225        self.boundary = [self.edge[k] for k in reg_edge]
    226226        #print "alpha boundary edges ", self.boundary
    227         self._init_boundary_triangles()           
     227        self._init_boundary_triangles()
     228       
     229        del tridata['generatedtriangleneighborlist']
     230        del tridata['generatedpointmarkerlist']
     231        del tridata['generatedpointlist']
     232        #del tridata['generatedpointattributetitlelist']
     233        del tridata['generatedsegmentlist']
     234        del tridata['generatedsegmentmarkerlist']
     235        del tridata['generatedtrianglelist']
     236        del tridata['generatedtriangleattributelist']
     237        del tridata['generatedpointattributelist']
    228238        return
    229239
  • anuga_core/source/anuga/mesh_engine/mesh_engine.py

    r4458 r4668  
    66
    77import anuga.mesh_engine.mesh_engine_c_layer as triang
     8#import anuga.mesh_engine.list_dic as triang
    89
    910from Numeric import array, Float, Int32
     
    121122    #print "segatts", segatts
    122123    #print "mode", mode
    123     return triang.genMesh(points,segments,holes,regions,
     124    mesh_dict = triang.genMesh(points,segments,holes,regions,
    124125                          pointatts,segatts, mode, segments.flat)
     126    mesh_dict['qaz'] = 1 #debugging
     127    return mesh_dict
    125128
    126129def add_area_tag(regions):
  • anuga_core/source/anuga/mesh_engine/mesh_engine_c_layer.c

    r4459 r4668  
    2626         
    2727     This is all that is needed to accomplish an intial triangulation.       
    28      A dictionary of the Triangle output is returned.                                   
     28     A dictionary of the Triangle output is returned.
     29           
     30     I thought this function was leaking. That the returned data
     31     structure didn't get garbage collected.  I decided this using 
     32     gc.get_objects() and seeing the dic still hanging around.
     33     I'm not so sure this means its leaking.  Check by looking at
     34     the overall memory use.  Anyhow, I delete the lists that are
     35     returned in the dic structre after they are used now, in alpha
     36     shape and mesh_engine.
     37     
    2938     Precondition
    3039     End list in the pointattributelist has to have the same length
     
    311320    Py_DECREF(ii); Py_DECREF(holderlist);
    312321  }   
    313      
    314322  /* Free in/out structure memory */
    315323 
     
    356364  }
    357365 
     366  /*Py_DECREF(holder);*/
    358367  return Py_BuildValue((char *)"O", holder);
    359368}
  • anuga_core/source/anuga/pmesh/mesh.py

    r4665 r4668  
    11651165                              meshDict['pointlist'])
    11661166        #print "%%%%%%%%%%%%%%%%%%%%%%%%%%%generated",generatedMesh
     1167        generatedMesh['qaa'] = 1
    11671168        generatedMesh['generatedsegmentmarkerlist'] = \
    11681169             segment_ints2strings(generatedMesh['generatedsegmentmarkerlist'],
     
    14911492        triangle attribute list: [(T1att), (T2att), ...]
    14921493
    1493 
    1494             (list of a list of strings)
    1495         lone point list:[point1, ...] (list of integers)
    14961494        """
    14971495        #Clear the current generated mesh values
     
    15671565            #print "Removing the loner", loner
    15681566            #self.meshVertices.pop(loner)
    1569 
     1567        # delete the info from this data structure
     1568        del genDict['generatedtriangleneighborlist']
     1569        del genDict['generatedpointmarkerlist']
     1570        del genDict['generatedpointlist']
     1571        del genDict['generatedpointattributetitlelist']
     1572        del genDict['generatedsegmentlist']
     1573        del genDict['generatedsegmentmarkerlist']
     1574        del genDict['generatedtrianglelist']
     1575        del genDict['generatedtriangleattributelist']
     1576        del genDict['generatedpointattributelist']
     1577        genDict['zpp'] = 1 # just an identifier
     1578           
    15701579    def setMesh(self, genDict):
    15711580        """
  • anuga_core/source/anuga/shallow_water/benchmark_sww2dem.py

    r4666 r4668  
    132132    ofile = 'lbm_resultsII.csv'
    133133    run_profile = False #True
    134     size_list = [[4,5],[5,40]]
     134    size_list = [[4,5],[50,40]]
    135135    #size_list = [[5,4]]
    136136
     
    166166            gc.collect()
    167167            print "mem", mem
    168             print " gc.get_objects() ", gc.get_objects()
     168            #print "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@",
     169            #print "gc.get_referrers()", gc.get_referrers()
    169170            #sys.gettotalrefcount()
    170171            fd.write(str(size[0]*size[1]) + delimiter +
     
    175176                     str(m1)  + delimiter +
    176177                     str(time) + delimiter + "\n")
    177 fd.close()                         
     178    print " gc.get_objects() ", gc.get_objects()
     179    fd.close()                         
Note: See TracChangeset for help on using the changeset viewer.