Fix low-memory situations so it doesn't muck up the heap any more.