#3 Added check of memory_limit