[Bf-python] BPy Armature memory leaks

Ken Hughes khughes at pacific.edu
Sat May 26 02:36:31 CEST 2007


Sorry if this is a repost -- Ken

Ken Hughes wrote:
> 
> 
> Campbell Barton wrote:
>> Revision: 10778
>>           
>> http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bforge-svn&revision=10778 
>>
>> Author:   campbellbarton
>> Date:     2007-05-25 18:43:25 +0200 (Fri, 25 May 2007)
>>
>> Log Message:
>> -----------
>> Many long standing memory leaks fixed in the BPY api.
>>
>> Data from Armature.c and logic.c still leaks.
>>
>> Mostly todo with PyList_Append adding a refcount and the bpython api 
>> not decrefing.
> 
> OK, I've tracked this down but want to pass off to Stephen or Joseph for 
> feedback or further examination.  The problem is the weakref PyList kept 
> in __main__. setup_armature_weakrefs() isn't deallocating the old list, 
> instead just adding a new one to the dictionary.  I added some code 
> there to first check for the existence of the __arm_weakrefs key, and if 
> it finds it deletes the key and then decrefs the list.  (Oh, I also 
> think there needs to be a decref in Armature_CreatePyObject() of weakref 
> after it's appended to the list).
> 
> This gets rid of the memory leak, but I forget precisely the reason for 
> the weakrefs in the first place; is this safe or am I overlooking 
> something?
> 
> Ken
> 
> 

!DSPAM:49,4657811836377980821581!





More information about the Bf-python mailing list