Memory overflow when saving Matplotlib plots in a loop

后端 未结 2 643
礼貌的吻别
礼貌的吻别 2021-01-13 12:39

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:          


        
2条回答
  •  孤独总比滥情好
    2021-01-13 13:11

    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
    

提交回复
热议问题