Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong cache split calculation in gdal2tiles.py #2020

Closed
EvertEt opened this issue Nov 15, 2019 · 2 comments
Closed

Wrong cache split calculation in gdal2tiles.py #2020

EvertEt opened this issue Nov 15, 2019 · 2 comments
Milestone

Comments

@EvertEt
Copy link
Contributor

EvertEt commented Nov 15, 2019

Expected behavior and actual behavior.

# Make sure that all processes do not consume more than GDAL_CACHEMAX
os.environ['GDAL_CACHEMAX'] = '%d' % int(gdal.GetCacheMax() / nb_processes)

GDAL_CACHEMAX expects a value in MB but gdal.GetCacheMax() returns the value in bytes.
https://trac.osgeo.org/gdal/wiki/ConfigOptions#SettingConfigOptions
https://gdal.org/api/raster_c_api.html?highlight=getcachemax#_CPPv415GDALGetCacheMaxv

This is also confirmed by a log in gdal2tiles.py:

print("Cache: %s MB" % (gdal.GetCacheMax() / 1024 / 1024))

Steps to reproduce the problem.

See behaviour. The RAM fills up, where I assume it is because of this mismatch.

Operating system

Ubuntu 18.04 64 bit

GDAL version and provenance

The 2.4.0 version from ubuntugis-stable PPA

@rouault
Copy link
Member

rouault commented Nov 15, 2019

Good analysis. Can you submit a pull request to fix that ? (I'd suggest to do a max of 1 and the result of the division, to avoid a 0 cache size)

EvertEt added a commit to EvertEt/gdal that referenced this issue Nov 15, 2019
rouault pushed a commit that referenced this issue Nov 15, 2019
rouault pushed a commit that referenced this issue Nov 15, 2019
@rouault rouault added this to the 2.4.4 milestone Nov 15, 2019
@rouault
Copy link
Member

rouault commented Nov 15, 2019

Fixed per #2022. Backported to branches 3.0 and 2.4

@rouault rouault closed this as completed Nov 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants