Java Heap Space problem

I have been trying to apply an orbit file to a S1 scene on SNAP, however, I am not able to finish it, because a Java Heap Space error pops up after several hours of processing. I know that it is a memory related error, and I have tried to solve it by increasing the virtual memory, as suggested in many posts.

However, when I do the same process (with the same scene) on an older computer (4 Gb RAM, i7 processor) it works in around 17 minutes while in my newer laptop it produces the mentioned error even though it has 4 times more RAM, better processor and solid-state hard disk.

What can be causing this problem?

You may have some background process using excessive memory. All the supported OS’s have tools to monitor memory usage and may help understand the issue. You could try running your job with no other programs running.

You don’t mention the values for the Java heap size (from -Xmx) for the different systems. A
reasonable default is set based on the system RAM at install time, so increasing the RAM allocated to a VM may require manual adjustments.

For the SNAP GUI, the Smart Configurer can help choose appropriate values for an installed SNAP after system memory has changed.

The gpt command-line tool has a gpt.vmoptions file in the same bin directory where you can adjust the Java heap size for gpt.

I have tried only with SNAP running, with the same results. I have cleaned the memory, I have increased the virtual memory…same result.

I have checked both gpt.voptions files both in the old and new machines and they are quite different.

Old laptop parameters (from the gpt.voptions file):
-Xmx8G

New laptop parameters: (derived from the snap-conf-optimiser, from the gpt.vmoptions file)
-Xmx11259m
-Xms2048m
-XX:+AggressiveOpts
-Xverify:none
-Dnetbeans.mainclass=org.esa.snap.main.Main
-Dsun.java2d.noddraw=true
-Dsun.awt.nopixfmt=true
-Dsun.java2d.dpiaware=false

Still no idea what is going on, I have applied the orbit file to several other scenes (on the old laptop) and all off them succeeded.

Are you using gpt or the SNAP GUI when you get the heap space error? Have you used the OS tools (consult OS documentation) to track memory usage? If you get the heap space error while there is lots of unused (or only used for caching) memory, then you need to review the -Xmx setting for the java process. Some users discover a background process consuming lots of memory. Your OS may be configured to limit user processes to less than the total installed memory.

You may try RamMap if you running SNAP in Windows. It will show you the amount of stand-by memory.
With this tool you can clean it and try again, but anyway if the memory is 4 GB this will happen.