I am using c-python apis to run some python code inside my cpp project. Everything is working all fine but suddenly I got one major issue that needs to be rectified.
I have this function that calls Python code inside it in some infinite loop.
void runPython(){
// init python module
// load module
// load function
while(1){
// create list using c-python api
// populate input
// call python function using c-python APIs
// get output and free up the references
}
}
So this scenario is working perfect. I have no memory leaks and it is able to run as long as I want. But then I changed some structure like this- I created a thread using std::thread and then assign this runPython() with this thread and run it. But after this, my python code executes in some half of the way and then I don't know where the thread goes. It stops executing the python code and never returns back to runPython thread anymore. If I have some other parallel threads running then that thread is running fine. I tried to use std::thread and pthread both as in pthread I tried to increase the stack size of this thread to around 1000mb but the issue is same.
Any idea what may be the cause?
Point : I have 7-8 big lists of float32 of size 100000 each that I am passing into python function.