_set_new_mode (Windows CE 5.0)
Developing an Application > Microsoft C Run-time Library for Windows CE > Run-time Library Reference
Sets a new handler mode for malloc.
int _set_new_mode(intnewhandlermode);
Parameters
- newhandlermode
New handler mode for malloc; valid value is 0 or 1
Return Values
_set_new_mode returns the previous handler mode set for malloc. A return value of 1 indicates that, on failure to allocate memory, malloc previously called the new handler routine; a return value of 0 indicates that it did not. If the newhandlermode argument does not equal 0 or 1, _set_new_mode returns –1.
Remarks
These functions are supported by all versions of the C run-time libraries.
The _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.
To override the default, call
_set_new_mode(1)
early in your program, or link with NEWMODE.OBJ.
Requirements
OS Versions: Windows CE 2.0 and later.
Header: new.h.
Link Library: coredll.dll.
See Also
calloc | free | malloc | realloc
Send Feedback on this topic to the authors