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).
I would use a MemoryError here instead of a RuntimeError (MemoryError is a builtin Python exception).