Skip to content

memory leak in both fwd and inverse transforms #7

@kkothari93

Description

@kkothari93
import numpy as np
import pyct as ct

img = np.random.rand(128,128)
A = ct.fdct2((128,128), 4, 16, False, norm=False, cpx=False)
c = np.random.rand(49577) #length of coeffs for 128x128 image

def check_leak_fwd(A, img):
  coeffs = np.zeros(49577)
  for i in range(5000):
    coeffs = A.fwd(img)

  return

def check_leak_inv(A, c):
  img = np.zeros((128, 128))
  for i in range(5000):
    img = A.inv(c)

  return 

if __name__=='__main__':
  check_leak_inv(A, c)

If you observe "free -h" on Ubuntu 18.04 with kernel 4.15.0-76-generic running python 3.6.8 while running the above file, you can clearly observe memory leak.
If you have memory_profiler installed you can also run mprof run --include-children python <filename> and confirm the leak. I also see the leak in Python2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions