Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import resource
- from scipy.stats import rv_continuous
- class Rv(rv_continuous):
- def __init__(self, x):
- rv_continuous.__init__(self, a=0, b=1)
- self.x = x
- def _pdf(self, y):
- return 1
- def call_rv(x):
- rv = Rv(x)
- # if the line below is commented out, memory usage stays constant
- s = rv.rvs()
- return 1
- for k in range(10000):
- x = call_rv(k)
- if k%1000==0:
- print 'Memory usage: %s (kb)' % resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement