1

How do we allocate memory limit to a python thread?

How does one use the threading and subprocess module to limit memory on that process? When I start threads ala the first answer here: How to use threading in Python?, the bash processes run sequentially instead of in parallel.

Siong Thye Goh
  • 3,518
  • 10
  • 23
  • 31
joyboy
  • 21
  • 4

1 Answers1

0

For the last bit of that question, if you want them to run sequentially, i think you can use Popen

and use .wait()

I did something like this in a recent code

    script='/some/script.exe'
    my_args = [
        "--endpoint",endpoint,
        "--userid", userid,
        "--password", password,
        ....
    ]

    #1. Run the command that gets docs from Docusign Retrieve
    #https://stackoverflow.com/questions/7681715/whats-the-difference-between-subprocess-popen-and-call-how-can-i-use-them
    subprocess.Popen([script] + my_args).wait()

As you can see, I decided to use Popen here because from What's the difference between subprocess Popen and call (how can I use them)? I saw that it was synchronous (call is non-blocking analogue)

amchugh89
  • 1,276
  • 1
  • 14
  • 33