I have a large vector<string> (about 1 million in size) that I need to process:
stringstream numStr;
cout << "before loop" << endl;
for(unsigned int i = 0; i < numList.size(); i++) {
cout << i << ": " << ((NORM_MAX - NORM_MIN) * (atoi(numList[i].c_str()) - min)) / (max - min) + NORM_MIN << endl;
int number = ((NORM_MAX - NORM_MIN) * (atoi(numList[i].c_str()) - min)) / (max - min) + NORM_MIN;
numStr << number;
numList[i] = numStr.str();
}
However, the program crashes upon reaching 36691 ~ 36693
(snip)
36689: 288
36690: 264
36691: 245
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
What can I do to find out the cause of this problem?
Aucun commentaire:
Enregistrer un commentaire