I'm using Qt on Ubuntu and doing a research test that needs many executions of my program. I decided to use the thread to optimise the time consumption, but I had a problem when the parameters are large. First I thought it's a problem of threads or object programming so I decide to simplify things to detect the source of the problem. I found the function that causes all problems. I put it in the main and execute it sequentially for many times with random parameters. It crashes between the 146000-156000 time. (To be sure I had re-execute the function with the parameters where it crash but it execute normally).
I had notice that putting the parameter object as global variable improves the number of time (it's 78000 when the 2 objects are parameters and about 150000 when they are global), other parameters are simple integer
I'm using many vectors as local variable of the function but I think this can't be the reason since they are destructed when the function finish the treatment.
What can be the reason of this crash?
for (int i=0;i<600000; i++){
int _trx=-1020+((rand())%2039);
int _try=-1020+((rand())%2039);
double _or=(rand()%36000)/100;
int _scale=rand()%2 -1 ;
std::cout << i <<": trans x: " << _trx << " | trans y: " << _try << " | or: " << _or << std::endl;
double _score= Test(1,_trx,_try, _or,1,0,5,5,1024);
cout <<" |score: " << _score << endl;
}