Hi esa snappy is consuming a lot of cache and RAM how can I prevent this:
To clear RAM I am using:
product.dispose()
but how to clear cache?
Hi esa snappy is consuming a lot of cache and RAM how can I prevent this:
To clear RAM I am using:
product.dispose()
but how to clear cache?
I think you will find my answer to this post helpful.
You can try to call the garbage collection directly.
See here:
Marco from EOMasters - Mastering Earth Observation -
I am already doing this:
jpy.get_type(“java.lang.System”).gc()
still it consumes too much memory
What do you mean by too much? How much does it consume and how much RAM do you have?
I have 32 gb RAM and I am doing time series calculations.Before starting of script my RAM consumption is 10GB then at the end it jumps to >30 GB
This is my flow:
1.open a product
2.upscale to 10 m
3.In for loop I am cropping polygons and performing indices calculations and dispose all the variables of polygon,ndvi,ndmi etc
4.After for loop I am disposing upscaled_product and product
5.Then I use jpy.get_type(“java.lang.System”).gc()
but in the end my RAM consumption reaches 30 gb
But you don’t get an OutOfMemory Exception. So, your process works.
Disposing objects and calling the garbage collector are only hints to the Java VM. It can, but don’t have to free memory. But if the memory is needed by another application it is released. But till then it keeps the memory allocated because allocating memory is an expensive operation.
How do you calculate the indices. Do you use GPF or do you calculate them manually?
If you do it manually, it would be good to do it in chunks of multiples lines or tile-wise.
In this example it is done line-wise: