Keil Logo

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

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 DUI0375H
Copyright © 2007, 2008, 2011, 2012, 2014-2016 ARM. All rights reserved. 

Related Knowledgebase Articles

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.