title: How to catch the kill signal inside c++ code
body: <p>I am testing an algorithm which can use lots of memory. I am running the algorithm on a shared machine. As I am expecting my application sometimes is being killed by OOM killer, receiving the following text: </p>
  
  <p><code>Killed</code></p>
  
  <p>However, inside my code I have the possibility to suspends some threads and free some resources, in such situations. 
  Is this possible that I handle the OS signal myself, and by freeing some resources prevent my application from being killed?</p>