forsee std::bad_alloc in C++
<p>As far as I understand std::bad_alloc exceptions in C++ are triggered when the program  runs out of memory. 
Is there a way to monitor how much memory left there are and trigger a special routine before we reach the point of no return ?</p>
