This eats up memory quickly on my system. import numpy.matlib as M def memleak(): a = M.randn(500, 1) while True: a = a.argsort(0)