From eec2ce04e3a1a57beda7774a27246b70c1a65787 Mon Sep 17 00:00:00 2001 From: EvertEt Date: Fri, 15 Nov 2019 14:31:54 +0100 Subject: [PATCH] Update cache calculation in gdal2tiles.py See #2020 --- gdal/swig/python/scripts/gdal2tiles.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gdal/swig/python/scripts/gdal2tiles.py b/gdal/swig/python/scripts/gdal2tiles.py index dd169c3b5e8f..106d4c8e8352 100755 --- a/gdal/swig/python/scripts/gdal2tiles.py +++ b/gdal/swig/python/scripts/gdal2tiles.py @@ -2867,8 +2867,8 @@ def single_threaded_tiling(input_file, output_folder, options): def multi_threaded_tiling(input_file, output_folder, options): nb_processes = options.nb_processes or 1 - # Make sure that all processes do not consume more than GDAL_CACHEMAX - os.environ['GDAL_CACHEMAX'] = '%d' % int(gdal.GetCacheMax() / nb_processes) + # Make sure that all processes do not consume more than `gdal.GetCacheMax()` + os.environ['GDAL_CACHEMAX'] = '%d' % max(1, int(gdal.GetCacheMax() / 1024 / 1024 / nb_processes)) (conf_receiver, conf_sender) = Pipe(False)