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. ArchiveDisclaimer


Returns an integer indicating new handler mode set by _set_new_mode for malloc.

int _query_new_mode(

Return Value

Returns the current new handler mode, namely 0 or 1, for malloc. A return value of 1 indicates that, on failure to allocate memory, malloc calls the new handler routine; a return value of 0 indicates that it does not.


The C++ _query_new_mode function returns an integer that indicates the new handler mode that is set by the C++ _set_new_mode function for malloc. The new handler mode indicates whether, on failure to allocate memory, 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. You can use _set_new_mode to override this behavior so that on failure malloc calls the new handler routine in the same way that the new operator does when it fails to allocate memory. For more information, see the operator delete and operator new functions in C++ Language Reference.


Routine Required header Compatibility
_query_new_mode <new.h> Win 98, Win Me, Win NT, Win 2000, Win XP

For additional compatibility information, see Compatibility in the Introduction.


All versions of the C run-time libraries.

See Also

Memory Allocation Routines | calloc | free | realloc | _query_new_handler | Run-Time Routines and .NET Framework Equivalents

© 2015 Microsoft