Does the exception "std::bad_alloc" mean that the system memory is out?

Does the exception "bad_alloc" mean that we don't have enough memory left? Can any other problem trigger this exception?
Why don't you do a search for bad_alloc on this site? It should be the first link.
I remember getting one. Every entry in a linked list added were on the same adress and thus a loop through I got this after 2GB ram were allocated in a matter of milliseconds. Are you doing any memory allocation in a loop?
The link referred to above does not explicitly answer the question, so I will. No it does not.
To add to the above, another problem that can trigger this exception is memory fragmentation. In this
case, there is (usually, more than) enough total, but not enough contiguous memory for your request.

There isn't much you can do when you get the exception (apart from terminating the program), so the best thing you can do to deal with this problem is prevent it, using custom memory allocators (e.g. memory pools).
Topic archived. No new replies allowed.