Skip to content

memory leak in functions using the C core

The following code shows the memory leak (~7 GB after 5000 iterations for dgt).

import numpy as np
from ltfatpy.gabor.dgtreal import dgtreal
from ltfatpy.gabor.dgt import dgt


x = np.random.rand(10000)
g = np.random.rand(256)

for _ in range(100000):
    print(_)

    # X, Ls, g = dgtreal(x, g=g, a=512, M=4096)
    X, Ls, g = dgt(x, g=g, a=512, M=4096)

There is even a simpler example :

from ltfatpy.fourier.pgauss import pgauss

for _ in range(100000):
    print(_)
    pgauss(100000000)