I am getting an error when running a code on linux machine:

"terminate called after throwing an instance of 'std::bad_alloc'
what(): St9bad_alloc

In my code i have a 2 dimensional vector defined.

Can someone tell me the possible cause of error.


Check if you are accessing memory that you have not allocated. Are you using an invalid pointer? Are you using pointers?

Are you referencing an iterator on the end of a vector? (ex: it.end())

Without source code, I cannot give you more advice. I hope that this tips will help.

Thanks.. your advise helped