Increase snappy memory (beginner)

Hi guys.

I know there is a lot of topics about this already, but I was hoping to get a little more detailed guide since i’m fairly new and having a hard time understanding all the posts. I’ve tried to change the gpt.vmoptions file to -Xmx6G, but nothing changed. The error I get is: java.lang.OutOfMemoryError: Java heap space

The gpt.vmoptions file affects only gpt. For configuring snappy
you need to the following:
You need to change the configuration in the snappy.ini file. The file is located in the snappy folder.
Change the line
# java_max_mem: 4G
to e.g.
java_max_mem: 6G

This means that snappy can use 6GB of you RAM. A recommended value is 70%-80% of the available RAM in your system.

2 Likes

Thanks, I tried to do what you suggested, but nothing changed. Do you have to do anything to set the values after you change them in the scripts?

From reading older posts I also tried to experiment with the two lines in the etc/snap.properties file:

snap.gpf.disableTileCache = true
snap.gpf.useFileTileCache = false

Now the final error message varies between Cannot construct DataBuffer and GC overhead limit exceeded. But from reading the stack trace it looks like java.lang.OutOfMemoryError: Java heap space and java.io.IOException: No memory left for cache! is causing the problems in all cases.

I see that you have earlier suggested a file cache option. Can that be used outside the SNAP GUI as well, and if so, how?

I’m sorry to take up your time with these beginner questions.

The file cache can be enabled if you set snap.gpf.useFileTileCache to true.
The settings in the snap-properties is also effective when you use gpt from the command line or snappy in Python.

In this post I have written a code snippet, how you can check if your java_max_mem setting is effective.


As I already said in the post it is still a bit buggy.

If you try to do some Sentinel-1 processing you might need to set even higher values as memory setting.
maybe 12 or 16 GB.