[Python-Dev] Python GC/type()/weakref mystery

Kevin Jacobs jacobs at theopalgroup.com
Thu Mar 18 12:34:13 EST 2004


Aahz wrote:

>On Thu, Mar 18, 2004, Kevin Jacobs wrote:
>  
>
>>Varying the value of N also results in strange results:
>>
>> for i in range(6):
>>   leak_test(10**i, new_type)
>>
>>Produces:
>> Leak detected (N=1, 1 new objects)
>> Leak detected (N=10, 9 new objects)
>> Leak detected (N=100, 90 new objects)
>> Leak detected (N=1000, 78 new objects)
>> Leak detected (N=10000, 9 new objects)
>> Leak detected (N=100000, 8 new objects)
>>    
>>
>
>This looks to me like standard boundary conditions for GC; GC normally
>only gets provoked when more than gc.get_threshold() objects have been
>created than deleted.  What makes you think something unusual is
>happening?
>  
>

I realize that this does look like standard GC threshold behavior  
However, it /shouldn't/, because
I manually run gc.collect() both before and after the test suite.  The 
other thing that is strange is
that all of these dead weakrefs disappear when I run gc.collect() as 
part of each iteration
of the test suite, but not afterwards.

Please read over my original mail again, since the magnitude of 
weirdness may not have
been obvious the first time through.

Thanks,
-Kevin





More information about the Python-Dev mailing list