When reading in areas of a VRT with the python gdal library, RAM usage keeps increasing up to about 50% of available memory. This is fine on a normal computer but becomes a problem for when running on a computing cluster with huge amounts of RAM available.
Is there a way to limit how much RAM gdal uses?
Edit:
I am reading in blocks of 256x256pixels at a time with vrt.ReadAsArray(...) which are immediately used and not needed afterwards anymore. However, judging by the memory consumption, gdal is keeping read tiles in memory in case they are needed again until the available memory is about 50% filled. Only then does it start deleting unused tiles from RAM. No matter what hardware I run the program on, memory consumption will keep increasing over time until it reaches the 50% mark.
I would like to limit this to something like 32Gb RAM.
I have found a CHACHE_MAX config option of gdal. However, upon checking the amount of used cache with gdal.GetCacheUsed() it is apparently always 0. So while the option sounded promising, this does not seem to provide a solution.