Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 681a6f2

Browse files
author
Jeff Whitaker
committed
triggers memory leak in fig.clf() for non-gui backends.
svn path=/trunk/matplotlib/; revision=3136
1 parent 5155eab commit 681a6f2

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

unit/memleak_nongui.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import os,matplotlib
2+
matplotlib.use('Agg')
3+
from matplotlib.figure import Figure
4+
from matplotlib.cbook import report_memory
5+
6+
def plot():
7+
fig = Figure()
8+
i = 0
9+
while True:
10+
print i,report_memory(i)
11+
fig.clf()
12+
ax = fig.add_axes([0.1,0.1,0.7,0.7])
13+
ax.plot([1,2,3])
14+
i += 1
15+
16+
if __name__ == '__main__': plot()

0 commit comments

Comments
 (0)