If you are dealing with memory leaks in Python, the easiest way to deal with them is to increase the memory allocation. While this is a quick fix, it comes at the cost of potentially creating an unstable product. A better solution is to profile the memory usage of the application to better gain an understanding of the code and the packages that are being used. Once you are able to profile the memory and understand where leaks are happening, you can better deal with memory dumps.
To try to fix and avoid memory leaks, consider running memory-intensive tasks in separate processes. This will reduce the number of memory leaks and ensures that memory is released only after code has been executed.