B V S S B X D I
Python Flask app file upload memory leak
Hi Brody, thanks for the quick response, however, I still think it is a problem with Railway. The same code doesn't cause the memory leak described above on fly.io, render.com, local docker container, local machine, etc.
the code is simply getting the file from a post request and saving it to the disk, something like
notes on the
.save()
method:
Save the file to a destination path or file object. If the destination is a file object you have to close it yourself after the call. The buffer size is the number of bytes held in memory during the copy process. It defaults to 16KB.Using
with open()
to write the file using a chunked stream also causes the memory leak. Basically anytime I write a file to the disk it causes the memory leak.18 replies