|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
Sets a new handler mode for malloc.
New handler mode for malloc; valid value is 0 or 1.
The C++ _set_new_mode function sets the new handler mode for malloc. The new handler mode indicates whether, on failure, malloc is to call the new handler routine as set by _set_new_handler. By default, malloc does not call the new handler routine on failure to allocate memory. You can override this default behavior so that, when malloc fails to allocate memory, malloc calls the new handler routine in the same way that the new operator does when it fails for the same reason. For more information, see the new and delete operators in the C++ Language Reference. To override the default, call:
early in your program or link with Newmode.obj (see).
This function validates its parameter. If newhandlermode is anything other than 0 or 1, the function invokes the invalid parameter handler, as described in . If execution is allowed to continue, _set_new_mode returns -1 and sets errno to EINVAL.
Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003
For more compatibility information, see Compatibility in the Introduction.
Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.