Added check of memory_limit