See Project settings
*"The configuration indicates whether the fields marked with (^) in the project settings dialog are for your development or your test environment.
The settings for your acceptance and production environment are configured in your runtime environment, see deployment."*
So basically, what you set here has no effect if you deploy in the cloud. The issue you're having is possibly caused by a high memory consuming action in your application when you don't have sufficient memory in the cloud. I'd try to optimize the actions that will lead to giving this error.
Edit: I thought you were deploying in the trial cloud, if you're deploying on your own server you can increase the memory in those settings. Check the link to project settings and follow the 'deployment' link. It's important to note starting the runtime itself also requires memory to load your application model. If your model is large, the default setting won't be enough.
You can set the maximum java heap size in the service console and in your project settings --> server tab. Because you're deploying in the cloud, I think your java heap exceeds your limit in the cloud. So try to change this in your project settings.