The following started out as a simple loop to find some averages of all numbers in some vectors. I kept adding the comments in to try and figure out what is going on. Oddly enough, the program crashes every time "i" reaches exactly "138232". I feel like my noobish status is leaving something blatantly obvious that I'm missing. I don't think it's out of memory. Last line in the console is
Process returned -1 (0xFFFFFFFF) execution time : 23.534s
//Find global averages of seperate colors
///ISSUES HERE=============================================================================
///Compiles fine, causes crash for unknown reasons when "i" reaches 138232
///Last output to stdout is "Inside Loop".
for (unsigned int i = 0; i < image1.size(); i = i + 4)
{
if(logExtraLoud)
std::cout<<std::endl<<"Inside loop"<<std::endl;
GA.red = averager(red1[i],red2[i], GA.red);
GA.green = averager(green1[i + 1],green2[i + 1], GA.green);
GA.blue = averager(blue1[i + 2],blue2[i + 2], GA.blue);
GA.alpha = averager(alpha1[i + 3],alpha2[i + 3], GA.alpha);
if(logExtraLoud)
{
std::cout<<"Good loop. "<< i <<std::endl;
std::cout<< i << ","<< i + 1 <<","<< i + 2 <<"," << i + 3 <<std::endl;
std::cout<<image1.size()<<std::endl;
std::cout<<"Ga.red: "<<GA.red<<std::endl;
std::cout<<"Ga.green: "<<GA.green<<std::endl;
std::cout<<"Ga.blue: "<<GA.blue<<std::endl;
std::cout<<"Ga.alpha: "<<GA.alpha<<std::endl;
}
}