fix code style and change next_limit to memory_limit