Handling Errors For The New Operator
Go Up to The new And delete Operators Index
By default, new throws the bad_alloc exception when a request for memory allocation cannot be satisfied.
You can define a function to be called if the new operator fails. To tell the new operator about the new-handler function, use set_new_handler and supply a pointer to the new-handler. If you want new to return null on failure, you must use set_new_handler(0) .