‘GC overhead limit exceeded’ runtime error using 'Terrain-Correction' in python

I have the following python code that works well on some RADARSAT-2 SLC images,

source = ProductIO.readProduct(in_file)
parameters = HashMap()
parameters.put('imgResamplingMethod', 'NEAREST_NEIGHBOUR')
parameters.put('applyRadiometricNormalization', True)
parameters.put('sourceBands', in_band)
parameters.put('pixelSpacingInMeter', pixel_res)
parameters.put('mapProjection', prj_wkt_main)
parameters.put('saveDEM', False)
parameters.put('saveSelectedSourceBand', False)
parameters.put('saveSigmaNought', True)
parameters.put('incidenceAngleForSigma0', 'Use projected local incidence angle from DEM')
target = GPF.createProduct('Terrain-Correction', parameters, source)
ProductIO.writeProduct(target, out_file, 'GeoTIFF'

But gives the following error on many RADARSAT-2 SLC images:
RuntimeError: org.esa.snap.core.gpf.OperatorException: Terrain-Correction: Terrain-Correction: GC overhead limit exceeded

As mentioned on this form I tried specifying the following settings within \snap\etc\snap.properties and running again:
snap.gpf.disableTileCache = true
snap.gpf.useFileTileCache = false
snap.gpf.disableTileCache = false
snap.gpf.useFileTileCache = true

As well in order to adjust the maximum memory usage I added -Xmx512m to \snap\bin\pconvert.vmoptions

I’m running windows 7 , 8GB i7-3520M
I still get the error. Any help would be much appreciated.

If you call SNAP from Python you need to change the memory setting elsewhere. The pconvert.vmoptions is not used here.
You need to change snappy.ini in the snappy directory which you have probably copied into the site-packages directory.

Change the java_max_mem property to e.g. 6G. Also remove the ‘#’ from the beginning of the line.

1 Like

Thanks so much. That was easy… it all works now.

Thanks for this post. Mentioning the name of the property helped me figure out that I had mislabeled “java_max_mem” erroneously as “max_mem”.