amitt001 / delegator.py

Subprocesses for Humans 2.0.
MIT License
1.7k stars 92 forks source link

Memory leaking with delegator.chain()? #75

Open psilocyber opened 5 years ago

psilocyber commented 5 years ago

I get a memory leak when using certain commands with the chain function. I boiled it down to this simple test case

import delegator

def run_shell_chain(cmd):
    return delegator.chain(cmd).out.strip("\n")

for i in range(50000):
    output = run_shell_chain("iostat -m -y 1 1")
    print(output)

If I watch ps, I can see the memory footprint increase indefinitely.

I cannot reproduce it with a simple piped hello world command. (echo 'hello world' | sed 's/hello/goodbye/')

System info

>>> pkg_resources.get_distribution("delegator.py").version
'0.1.1'

$ python3 -V
Python 3.6.8

 ~$ uname -a
4.18.0-25-generic #26~18.04.1-Ubuntu SMP Thu Jun 27 07:28:31 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

delegator-chain-with-original-cmd