Skip to content

Memory leak #180

@dmpetrov

Description

@dmpetrov

It looks like pywt has a memory leak. When I process more than 200K small images (<10 KB each) a process takes all 16GB of my memory and stops (or slows down).

  • Code

whash() function from imagehash lib:
JohannesBuchner/imagehash@da9386d

Reproduction code snippet:

res = {}
i = 0
for filename in onlyfiles:
    fname = os.path.join(filedir, filename)
    try:
        image = PIL.Image.open(fname)
        whash = imagehash.whash(image)
        value = whash.hash.flatten()
        res[int(filename[:-4])] = sum(1<<i for i, b in enumerate(value) if b)
    except Exception as e:
        print("Error. File " + fname + ": ", e )

Btw.. imagehash.phash() function doesn't use pywt and doesn't have this issue.

  • Data

Image subset from Avito competition:
https://www.kaggle.com/c/avito-duplicate-ads-detection

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions