Skip to content

Instantly share code, notes, and snippets.

@KFGD

KFGD/example.cpp Secret

Last active January 9, 2018 00:44
(Basic) new_set_handler(1)
/*
Test Environmnet: Ubuntu 14.04.5 LTS
Compiler: GCC 5.4.1. 20160904
*/
//Just use new function, not using custom new_set_handler
//This C++ code cause a Runtime-Error.
//Error: terminate called after throwing an instance of 'std::bad_alloc'
#include <iostream>
int main(){
int *pMemory = new int[10000000000];
delete[] pMemory;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment