Fix out-of-memory problem.