Brian Granger wrote: > Hi, Hi Brian,
> 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: I am not really aware of any specific issue with the Python on Leopard. > 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? Yes, at least to see if it can spot the problem. To get started: Build your own python. Make sure to compile it with "--without-pymalloc" and also set the compile flags to "-O0 -g". Build valgrind 3.3.0 [or install it from binary packages] and run your code under it. If it segfaults valgrind [it happens to me somewhat regularly, but then usually something evil is happening in libSingular ;] go and check out the 3.4svn version. Let me know if you have any trouble. > When people have seen this type of thing with cython, what types of > things have been the culprit? (ie, where should I start looking). This is likey a __dealloc__ problem. Valgrind helps there since it detects mismatched free and delete for example. > Thanks, > > Brian Cheers, Michael > _______________________________________________ > Cython-dev mailing list > [email protected] > http://codespeak.net/mailman/listinfo/cython-dev > _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
