Out of memory kills uwsgi process

This amount of memory is used by copying all the records in the database of a company to ZIP-file.
However, I found the solution. I increased the capacity of the server and it worked.
I didn’t create the copy to zip code by my self and it’s only running on a production server so I prefer to not edit the code.