In a certain (consistent) point when my app is running, I consistently get the xcode error message
Terminated due to memory error.
Restart device worked for me. “Terminated due to memory error” message stopped to appear.