Error: *** glibc detected *** ./ : double free or corruption (!prev): 0x0a952000 ***

I am building a small library using CUDA and Nsight. Some of library functions are CUDA-based functions, some are just standard C++ functions. If I just test the library’s C++ function, it works fine, but if the testing code first runs some CUDA-based functions and then run the C++ functions, it will give me this error. So I dont know what the real cause of it is. Can anyone give me any suggestions? By the way, I compiled those CUDA functions and the C++ functions into one shared library and called that library in my testing program.


Have you tried running your application with valgrind?