operator new with empty exception-specification calling constructor when allocation returns 0
I have the following declaration: void * operator new (size_t s, PersistentMemory * m) throw() {return m->allocatePersistentMemory(s);} I'm testing memory exhaustion on start-up, which results in m->allocatePersistentMemory(s); returning 0. New then calls the constructor with a null pointer for this However, based on 3.7.3.1 paragraph 3 of C++ 2003 standard: An allocation function that fails to allocate storage can invoke the currently installed new_handler (18.4.2.2), if any. [Note: A program-supplied allocation function can obtain the address of the currently installed new_handler using the