Throw an exception if there is not enough memory. Fixes #299
Merge branch '3.6' of github.com:impresspages/ImpressPages-CMS into 3.6