Running the following code will result in memory usage rapidly creeping up.
import numpy as np
import pylab as p
mu, sigma = 100, 15
x = mu + sigma*np.random.randn(100000)
for i in range(100):
n, bins, patches = p.hist(x, 5000)
However, when substituting the call to pylab with a direct call to the numpy histogram method then memory usage is constant (it also runs significantly faster).
import numpy as np
mu, sigma = 100, 15
x = mu + sigma*np.random.randn(100000)
for i in range(100):
n, bins = np.histogram(x, 5000)
I was under the impression that pylab is using the numpy histogram function. There must be a bug somewhere...