bad_alloc in these situations?

Joined
Feb 12, 2008
Messages
108
Reaction score
0
Hello everyone,


In these situations, whether bad_alloc will be thrown?

1. Memory is reserved, even if not used. No "enough" memory to new operator (which reflects not enough memory for VirtualAlloc, even if not used (committed), but reserved);

2. The heap's internal data structures could be corrupted such that it cannot find the next free block (no pointer to the next free block), which would make it think it is out of memory.

3. The heap's internal data structures could be corrupted so that it points to random memory location, which could cause a crash, or try to give you memory that was still in use.

My option, (1) and (2) will throw bad_alloc, for (3) structured exception (access violation) will be thrown?


thanks in advance,
George
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top