[Bf-python] Blender, Python, and Irix

Jonathan Merritt j.merritt at pgrad.unimelb.edu.au
Wed Nov 10 07:58:40 CET 2004


Stephen Swaney wrote:

>Chris Want wrote:
>
>  
>
>>["/usr/people/cwant/blender/bf-blender/blender/source/blender/python/BPY_interface.c":170
>>More (n if no)?n
>>
>>I hope this is enough information to point to something
>>obvious... if not, I'll have to remove python support for
>>the irix build.
>>    
>>
>
>Hmmm, not good.  Line 170 in BPY_interface.c is a call to Py_Finalize().
>The fact that it blows up here combined with general, hard-to-reproduce
>instability makes me suspect reference counting bugs.  These can be
>difficult to chase down.
>  
>

Is it possible to use some kind of "debug mode" for reference counts in 
Python?

Before we moved to using boost::shared_ptr, Aqsis had a reference 
counting scheme similar to that used in Python.  I wrote a debug version 
of the reference count class that reported:
    a) When memory was accessed that had theoretically already been freed.
    b) The references that were still held at the termination of the 
renderer (which is a good point to check for such things in the Aqsis 
context).
That implementation revealed quite a few bugs which otherwise would have 
been difficult or impossible to detect.  Because it was built into Aqsis 
itself, I understood it completely, and could confidently proceed in my 
debugging attempts.  (I personally wouldn't have such confidence in a 
less-specific tool.)

I know that tools like valgrind can perform similar tasks, but are 
difficult to use because they can often report "false positives".  Has 
anyone (grin, cough, splutter, etc... :-) dared to try to run Blender 
(or  a session of Python itself) through valgrind yet?

Jonathan Merritt.




More information about the Bf-python mailing list