What does this error mean?!?!
May 3, 2009 at 9:50pm UTC
I am getting this error message when I run my program, what does it mean?!
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
92Aborted
Thanks for the help!!
May 3, 2009 at 9:54pm UTC
Sounds like you ran out of memory.
May 3, 2009 at 9:58pm UTC
well that's odd because it doesn't really seem like I am accessing too much with a file that I'm accessing from that has 20 integers. Here is the function where it's coming from...why would I be running out of memory? Thanks!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
vector <int > numbers::sort_down(vector <int > unsorted_list)
{
int count = 0;
if (unsorted_list.size() == 1)
cout << unsorted_list[0];
else
{
int max = unsorted_list[0];
for (int i = 0; i < unsorted_list.size(); i++)
{
if (max < unsorted_list[i])
{
max = unsorted_list[i];
count = i;
}
}
cout << max << " -- " ;
numbers::remove(count);
numbers::sort_down();
}
}
It outputs all of the numbers, except the last one, because then it shows that error message...thanks again for the help!
Topic archived. No new replies allowed.