[IPython-user] Debugging with IPython.

Alexander Schmolck a.schmolck at gmx.net
Fri Apr 15 05:57:50 CDT 2005

Fernando Perez <Fernando.Perez at colorado.edu> writes:

> Andrea Riciputi wrote:
>> Hi all,
>> I'm try to debug and trace some Python-wrapped C code and in particular I'm
>> mainly interested to check for memory leaks.
>> What I have is a bunch of C function accepting multi-dimensional arrays as
>> input parameters and returning other arrays. These functions have been
>> wrapped into a Python module, and I'd like to check whether the module
>> behaves correctly from with Python. In particular I'm interested in checking
>> if all the data structure are de-allocated correctly when they come out of
>> scope.
>> May I do these kind of things using pdb from within IPython? How?
> Not that I know.  As far as I know, all C extension code is a black box to
> pdb.  In order to get internal info from your extension modules, you'll need
> to resort to traditional gdb tactics, and I think that to really get very far
> you need to work with a debug build of python.

I second that you'll presumably want a debug build (you just need to
./configure --with-py-debug IIRC). I'd also recommend that you have a look a
valgrind. You also can get some info interactively using the gc module.


More information about the IPython-user mailing list