Python matplotlib: memory not being released when specifying figure size

后端 未结 2 633
我寻月下人不归
我寻月下人不归 2021-02-03 23:28

I\'m using matplotlib to generate many plots of the results of a numerical simulation. The plots are used as frames in a video, and so I\'m generating many of them by repeatedly

2条回答
  •  感动是毒
    2021-02-03 23:41

    From the docstring for pylab.figure:

    In [313]: pylab.figure?
    

    If you are creating many figures, make sure you explicitly call "close" on the figures you are not using, because this will enable pylab to properly clean up the memory.

    So perhaps try:

    pylab.close()     # closes the current figure
    

提交回复
热议问题