10.5 Using the ::operator new function in ARM C++

In accordance with the ISO C++ Standard, the ::operator new(std::size_t) throws an exception when memory allocation fails rather than raising a signal. If the exception is not caught, std::terminate() is called.

The compiler option --force_new_nothrow turns all new calls in a compilation into calls to ::operator new(std::size_t, std::nothrow_t&) or ::operator new[](std::size_t, std::nothrow_t&). However, this does not affect operator new calls in libraries, nor calls to any class-specific operator new.

Legacy support

In RVCT v2.0, when the ::operator new function ran out of memory, it raised the signal SIGOUTOFHEAP, instead of throwing a C++ exception.
In the current release, it is possible to install a new_handler to raise a signal and so restore the RVCT v2.0 behavior.

Note

Do not rely on the implementation details of this behavior, because it might change in future releases.
Non-ConfidentialPDF file icon PDF versionARM DUI0375F
Copyright © 2007, 2008, 2011, 2012, 2014 ARM. All rights reserved.