On Apr 18, 2008, at 1:20 PM, Brian Granger wrote:

> Hi,
>
> I have wrapped some templated c++ code using Cython.  The c++ code
> uses templates and I am using the "evil nasty" tricks that cython
> allows to handle this.  Everything was working fine (beautifully in
> all actuality)....until I started getting seg faults, bus errors and
> messages like:
>
> Python(4538) malloc: *** error for object 0x311140: Non-aligned
> pointer being freed (2)
> *** set a breakpoint in malloc_error_break to debug
>
> These problems show up in very simple case, such as when importing a
> module, instantiating a class and Python exiting.
> I am running the Python 2.5.1 that comes with Leopard.  From look back
> at sage-devel list, it looks like this could be a problem with the
> 2.5.1. that comes with Leopard.  I am going to try things on a Linux
> box to see if that helps.  But I have some more general questions:
>
> Does any one have general thoughts/experience is debugging these types
> of things in Cython?
>
> Is valgrind a good option?  Any hints on getting started with cython 
> +valgrind?
>
> When people have seen this type of thing with cython, what types of
> things have been the culprit?  (ie, where should I start looking).

I haven't personally wrapped much C++ code, but I know there is a  
fair amount wrapped in sage. (look for cpp, and the corresponding pyx  
files in http://hg.sagemath.org/sage-main/file/cc1e12a492fc/sage/ for  
lots of examples).

Though I have not personally tried it, people do use cython+valgrind.  
I use gdb mostly (and print statements). One problem with Cython code  
is that is it weaves in and out of the python interpreter, the C and  
Python stacktraces are of varying degrees of utility.

- Robert
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to