What are reasons for a bad allocation exception

Viewed 49

The documentation says that std::bad_alloc exception is thrown on failure to allocated storage.

What are the steps that for example Windwos 10 does to allocated heap storage for a C++ application? Any Documentation on this would be helpful.

Does this mean std::bad_alloc is thrown when;

  • The process does not have the required contiguous virtual address space to allocate storage.
  • The operating system does not have required contiguous physical memory space to allocate storage.
  • Both or neither?
0 Answers
Related