[Numpy-discussion] Memory leak with numpy master

Gael Varoquaux gael.varoquaux at normalesup.org
Mon Sep 24 13:04:34 EDT 2012

Hi list,

I think that I am hit a memory leak with numpy master. The following code
enables to reproduce it:

import numpy as np
n = 100
m = np.eye(n)
for i in range(30000):

    t, result_t = np.linalg.linalg._commonType(m)
    a = np.linalg.linalg._fastCopyAndTranspose(t, m)

    pivots = np.zeros((n,), np.linalg.linalg.fortran_int)
    results = np.linalg.lapack_lite.dgetrf(n, n, a, n, pivots, 0)
    d = np.diagonal(a)

    if not i % 1000:
        print i

If you execute this code, you'll see the memory go steadily up.

The reason that I came up with such a strange looking code is that in my
codebase, I do repeated calls to np.linalg.slogdet. I came up with the
code above by simplifying what is done in slogdet. I don't think that I
can simplify any further and still reproduce the memory leak.

Should I submit a bug report (in other words, can people reproduce?)?



More information about the NumPy-Discussion mailing list