How to debug "detected glibc *** python: malloc (): memory corruption"

I am using python2.5 with scipy.weave to insert c code.

There is no malloc () function in my c code, but I got an error like

"glibc detected *** python: malloc(): memory corruption" 

from time to time (this is a random algorithm)

So how do I debug it?

thanks

+4
source share
1 answer

I would risk assuming your code is overflowing the array somewhere (or causing Python to do this).

You will find that debugging will be difficult if you cannot reliably reproduce it, so you can explicitly sow the random number generator and try to find a seed with which you can reproduce the damage. You may also find that with a tool like valgrind , it’s useful to keep track of when you write within the selection - perhaps more so when you can play it every time.

+7
source

All Articles