I have an application deployed on Google App Engine and it throws: java.lang.OutOfMemoryError: Java heap space
error while executing. I came across some solutions that talk about how to increase the heap size of VM by configuring eclipse.ini
file, however that works only when application's running locally, so how do we configure and control the heap space size when the application is deployed on Google App Engine, is there a way to access the Java runtime on Google app engine ? Any help would be greatly appreciated.

- 317,000
- 35
- 244
- 286

- 1,328
- 1
- 10
- 26
-
The eclipse.ini controls the amount of memory given to Eclipse, not applications you launch from within it. – nitind Mar 30 '15 at 14:51
-
2You'll probably want to address the heart of the matter: why is the code overflowing the heap? Increasing the heap size is not a real solution, as larger inputs might cause overflows anyway depending on the program. – DennisW Mar 30 '15 at 14:51
-
1I would surely want to know why the code is overflowing the heap only when I'm sure that the heap space allocated in the run time is enough, so is there a way to know what is the heap size on Google App Engine ? – Raghvendra Kumar Mar 30 '15 at 14:57
-
2I haven't used GAE myself, but I believe https://cloud.google.com/appengine/docs/adminconsole/performancesettings?hl=en holds the answer. Probably 128MB – DennisW Mar 30 '15 at 15:08
-
It looks like Java machine is running out of memory, so will increase Java heap size. To that checkout http://stackoverflow.com/questions/1565388/increase-heap-size-in-java – BK Batchelor Mar 30 '15 at 15:12
-
you can change it from admin console, under Application Settings tab of you Appengine app. Up to 1Gb (`F4_1G` instance) from default 128m (`F1` instance) – Igor Artamonov Mar 30 '15 at 15:26
2 Answers
As already stated you can increase your frontend instances to larger instances on the "Application Settings" (on the old GAE console) , unfortunately that might not really help you.
If you really need memory intensive operations consider moving taht portion of your app to a managed VM or a Cloud compute instance where you have more control over the environment in which your app runs.

- 1,674
- 1
- 11
- 18
In order to configure memory for an application deployed on GAE, previously there were options to select a Front end Instance Class which is shown in screenshot below :
However these options are no longer available on the GAE admin console, the screenshot below shows that GAE has fewer options now :
Now the same Front end Instance Class needs to be configured using a XML file as part of the application as decribed on this page : https://cloud.google.com/appengine/docs/java/modules/#Java_Configuration

- 1,328
- 1
- 10
- 26