Open aloi214 opened 6 months ago
@aloi214 Thanks for the report! I have a few questions:
GDAL_CACHEMAX=0
?@sgillies Thanks for replying. As I know, usually the occupied memory after finishing each request should keep same after first request. And I run more test:
GDAL_CACHEMAX
as
def create_mask(polyline):
polyline = np.array(polyline)
origin = polyline.min(axis=0)
site_shape = (polyline.max(axis=0) - polyline.min(axis=0))[::-1].astype(int)
shapely_geo = sg.Polygon(polyline-origin)
with rasterio.Env(GDAL_CACHEMAX=0, CPL_VSIL_CURL_CACHE_SIZE=0, VSI_CACHE=False, VSI_CACHE_SIZE=0, aws_unsigned=True) as env:
control_mask = features.geometry_mask([shapely_geo], out_shape=site_shape, transform=transform.IDENTITY, invert=False)
return control_mask
export GDAL_CACHEMAX=0
in command line to limit GDAL_CACHEMAX
.But the memory are keeping increase in all those cases. I'm not sure if I limit the GDAL_CACHEMAX successfully.
Expected behavior and actual behavior.
I'm using
geometry_mask
function in fastapi, service's memory should be released after each request, no memory increase in iteration.Actual behavior
Memory is not released, consumed memory increases with every request.
Steps to reproduce the problem.
Using top command can monitor the occupied memory will increase in iterations. If I replace create_mask by a string, the occupied memory will keep same.
Environment Information