Add an hard limit to check_mem_usage()

Proposal: to avoid loss of control when an OOM occurs on the server we implement an hard memory limit (like we already do with just a warning).