how to solve not enough memory problem