Open1

How manage memory

yuuyuu

matplotlib adds a bunch of overhead, so you shouldn't use it if it's not necessary.
If you wanna use, the better way to write is:

#this is needed to keep memory under control (prevents further generation of previews)
matplotlib.use('Agg')

from here