I am looking how to force that new operator will return NULL instead of std::bad_alloc exception when lack of memory. I have on the beginning of code mlockall(MCL_FUTURE); this forces malloc() to return NULL if out of nemory, but new operator throws exception. I know that in Windows Visual C++ throwing new is set by chosing standard C++ library and nonthrowing new is from main CRT, so in VS I can choose one of these two features. Is possible in C++ code compiled with g++ to force new operator to return NULL instead of std::bad_alloc ? Thank you, Peter