I would like to write a program to consume all the memory available to understand the outcome. I\'ve heard that linux starts killing the processes once it is unable to alloc
If all you need is to stress the system, then there is stress tool, which does exactly what you want. It's available as a package for most distros.