Treat OOM cases
Merge pull request #1782 from hardening/oom_cases

Treat OOM cases