Skip to content

Memory leak on Cygwin when forking #2063

Closed
@embray

Description

@embray

In #1450 I made a fix on Cygwin to ensure that the thread pool is properly shut down before forking process.

However, I've observed now that there's a memory leak associated with this somehow: Repeatedly shutting down the thread pool, then starting it up again to do some multi-threaded operation, then forking again and so on quickly leaks memory. I was able to reproduce this simply using Python with a Numpy linked against OpenBLAS (where np.linalg.inv happens to use dgesv):

>>> import numpy as np
>>> import subprocess as sp
>>> mat = np.random.random(9).reshape((3, 3))
>>> while True:
...     _ = np.linalg.inv(mat)
...     _ = sp.call(['true'])
...

While letting this loop run the memory usage of the original process quickly blows up to several gigabytes.

I will investigate further.

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