You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
is where (I guess) the memory allocation happens because there no more memory leak when this line is commented.
In my case this happens because I am instanciating this raster io environment into a web (fastapi) route callback where the with statement code is called on every route call.
I cannot do much in my code context in an obvious way with current rasterio.Env api which is usable only using a with statement.
For now I fixed my code with this code which is not clean but does the trick. I never release ressources from the __exit__ method but this is ok as we are in an ever living web route callback and I cache the rasterio.Env instance.
Hi folks.
Thank you for your work on this project.
I meet an issue on our project where
Generates a memory leak. When one run this code and look for process memory usage, it looks like memory is never released overtime.
By digging a bit more in the code, it looks like the following code is related to the issue:
https://github.com/rasterio/rasterio/blob/main/rasterio/env.py#L334
this is where
__enter__
code generate a new GDAL environment instancethen
https://github.com/rasterio/rasterio/blob/main/rasterio/env.py#L338
is where (I guess) the memory allocation happens because there no more memory leak when this line is commented.
In my case this happens because I am instanciating this raster io environment into a web (fastapi) route callback where the with statement code is called on every route call.
I cannot do much in my code context in an obvious way with current rasterio.Env api which is usable only using a with statement.
For now I fixed my code with this code which is not clean but does the trick. I never release ressources from the
__exit__
method but this is ok as we are in an ever living web route callback and I cache therasterio.Env
instance.On the first call, I instanciate the rasterio context and it lives and is cached for all subsequent calls from
self.gdal_env
variable.Thank you for any help solving this.
The text was updated successfully, but these errors were encountered: