Handle C++ "new" memory exhaustion

Technical Note 92391

Architectures:

All

Component:

compiler

Updated:

2015/11/6 12:29

Introduction

When new runs out of memory, I get a call to abort or an exception.

I want it to return NULL.

Possible solution

Use the nothrow variant of new as illustrated in provided Screen dumps and Example ProjectExample IAR Embedded Workbench for ARM 7.20.zip.

Background

See section USING NEW HANDLERS in the compiler guide, for example "IAR C/C++ Development Guide" for ARM (page 186 in Part number: DARM-12), for related info.

 

All product names are trademarks or registered trademarks of their respective owners.

很抱歉,该页面尚未翻译成中文。

如果您有任何问题,请联系我们的中国团队

We do no longer support Internet Explorer. To get the best experience of iar.com, we recommend upgrading to a modern browser such as Chrome or Edge.