[hg] galaxy 2858: fixed trackster memory leak
details: http://www.bx.psu.edu/hg/galaxy/rev/50e2d1a49815 changeset: 2858:50e2d1a49815 user: Kanwei Li <kanwei@gmail.com> date: Thu Oct 08 15:53:11 2009 -0400 description: fixed trackster memory leak 1 file(s) affected in this change: lib/galaxy/visualization/tracks/data/array_tree.py diffs (45 lines): diff -r e1382afd8e41 -r 50e2d1a49815 lib/galaxy/visualization/tracks/data/array_tree.py --- a/lib/galaxy/visualization/tracks/data/array_tree.py Thu Oct 08 14:57:36 2009 -0400 +++ b/lib/galaxy/visualization/tracks/data/array_tree.py Thu Oct 08 15:53:11 2009 -0400 @@ -20,13 +20,15 @@ self.dataset = dataset def get_stats( self, chrom ): - d = FileArrayTreeDict( open( self.dataset.file_name ) ) + f = open( self.dataset.file_name ) + d = FileArrayTreeDict( f ) try: chrom_array_tree = d[chrom] except KeyError: return "no data" root_summary = chrom_array_tree.get_summary( 0, chrom_array_tree.levels ) + f.close() return { 'max': float( max(root_summary.maxs) ), 'min': float( min(root_summary.mins) ) } def get_data( self, chrom, start, end ): @@ -35,7 +37,8 @@ level = int( ceil( log( end - start, BLOCK_SIZE ) ) ) - 1 # Open the file - d = FileArrayTreeDict( open( self.dataset.file_name ) ) + f = open( self.dataset.file_name ) + d = FileArrayTreeDict( f ) # Get the right chromosome try: chrom_array_tree = d[chrom] @@ -51,12 +54,14 @@ # Return either data point or a summary depending on the level if level > 0: s = chrom_array_tree.get_summary( start, level ) + f.close() if s is not None: return zip( indexes, map( float, s.sums / s.counts ) ) else: return None else: v = chrom_array_tree.get_leaf( start ) + f.close() if v is not None: return zip( indexes, map( float, v ) ) else:
participants (1)
-
Greg Von Kuster