Hi,

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
Aborted"

In my code i have a 2 dimensional vector defined.

Can someone tell me the possible cause of error.

Thanks

Recommended Answers

All 2 Replies

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.