debugging tip - valgrind friendly python

Alexander Belchenko bialix at ukr.net
Wed Dec 2 12:15:29 GMT 2009


James Henstridge пишет:
> On Wed, Dec 2, 2009 at 1:36 PM, Alexander Belchenko <bialix at ukr.net> wrote:
>> Robert Collins пишет:
>>> https://edge.launchpad.net/~jamesh/+archive/python
>>>
>>> these packages have pymalloc disabled, so valgrind gets a more accurate
>>> picture of whats happening.
>>>
>>> YMMV enjoy.
>>>
>>> Thanks James ;)
>>>
>>> -Rob
>> I'm using suppression file for valgrind from Python sources with success. It's enough to test
>> failures in C-code invoked from Python.
>>
>> http://svn.python.org/projects/python/trunk/Misc/README.valgrind
> 
> Note that you'll miss out on a lot with those suppressions.  Any
> memory allocated through PyObject_Malloc/PyObject_Free may be
> allocated from one of pymalloc's memory pools.  Valgrind only sees the
> allocations of the larger pools, so won't track those individual
> allocations.  All the suppressions do is get rid of the uninitialise
> read warnings.  You'll miss out on many potential errors like this.
> 
> The packages in my PPA include a patch that gets the interpreter to
> detect whether it is running under valgrind or not.  If it is, then
> the pymalloc allocator is disabled, with PyObject_Malloc/PyObject_Free
> passing through to normal malloc/free, which valgrind knows how to
> track.

Oh, that's cool. Thanks.




More information about the bazaar mailing list