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

Skip to content

Commit 2025ce4

Browse files
committed
added inside poly memleak unit test
svn path=/trunk/matplotlib/; revision=2753
1 parent 167fbff commit 2025ce4

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

unit/inside_poly_memleak.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env python
2+
3+
import os, sys, time
4+
import matplotlib.nxutils as nxutils
5+
import matplotlib.numerix as nx
6+
7+
def report_memory(i):
8+
pid = os.getpid()
9+
a2 = os.popen('ps -p %d -o rss,sz' % pid).readlines()
10+
print i, ' ', a2[1],
11+
return int(a2[1].split()[1])
12+
13+
14+
15+
for i in range(500):
16+
report_memory(i)
17+
verts = nx.mlab.rand(100, 2)
18+
b = nxutils.pnpoly(x, y, verts)
19+
20+
for i in range(500):
21+
report_memory(i)
22+
verts = nx.mlab.rand(100, 2)
23+
points = nx.mlab.rand(10000,2)
24+
mask = nxutils.points_inside_poly(points, verts)
25+

0 commit comments

Comments
 (0)