From c7e8356e5239100fc15d589a919bec34130e6e42 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 16 May 2018 12:31:41 +0200 Subject: [PATCH] m.plots: matplotlib otherwise keeps everything in memory. Huh. --- pelican-plugins/m/plots.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pelican-plugins/m/plots.py b/pelican-plugins/m/plots.py index 173ca76d..1d09cf97 100644 --- a/pelican-plugins/m/plots.py +++ b/pelican-plugins/m/plots.py @@ -214,6 +214,7 @@ class Plot(rst.Directive): fig.patch.set_visible(False) # hide the white background imgdata = io.StringIO() fig.savefig(imgdata, format='svg') + plt.close() # otherwise it consumes a lot of memory in autoreload mode # Patch the rendered output: remove preable and hardcoded size imgdata = _patch_src.sub(_patch_dst, imgdata.getvalue()) -- 2.30.2