Memory overflow when saving Matplotlib plots in a loop
matplotlib, memory-management, python
Solution
Are you remembering to `close` your figures when you are done with them? e.g.:
import matplotlib.pyplot as plt
#generate figure here
#...
plt.close(fig) #release resources associated with fig
Problem
I am using an iterative loop to plot soame data using Matplotlib. When the code has saved around 768 plots, it throws the following exception. ``` RuntimeError: Could not allocate memory for image ``` My computer has around 3.5 GB RAM. Is there any method to free the memory in parallel so that the memory does not get exhausted?