Memory Problem

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Sep 20 01:48:56 EDT 2007


En Tue, 18 Sep 2007 12:24:46 -0300, Christoph Scheit  
<cscheit at lstm.uni-erlangen.de> escribi�:

>> >> >  # add row i and increment number of rows
>> >> >  self.rows.append(DBRow(self, self.nRows))
>> >> >  self.nRows += 1
>>
>> This looks suspicious, and may indicate that your structure contains
>> cycles, and Python cannot always recall memory from those cycles, and  
>> you
>> end using much more memory than needed.
>
> How can I detect if there are cycles?

Analyzing your code, or maybe inspecting gc.garbage, or looking at  
sys.getrefcount(x)

> self.rows is a list containing DBRow-objects,
> each itself being an integer pointer (index) to the i-th row.
> Im using this list in order to sort the table by sorting the index-list
> instead of realy sorting the entries. (or to filter).

What looks strange is the "self" argument to DBRow, since the items are  
already contained in self.rows
But it's hard to tell anything more without looking at your code.

-- 
Gabriel Genellina




More information about the Python-list mailing list