1

I want to set higher stack size in a python script as i am working with a larger dataset. I found this link useful but it only corresponds to the Linux. Could someone provide package with proper instructions on how to implement that.

So, for clarity this is the code that gets the job done in Linux&BSD:

import resource
resource.setrlimit(resource.RLIMIT_STACK, (2**29,-1))

As a side note, Probably psutil package can do this but i have been searching for setting stacksize in their official doc(actually found smth but it is again for Linux) and could not find smth..

Any recommendation..

user20210310
  • 104
  • 6

1 Answers1

1

On Windows, you have to create a new thread in order to increase stack size:

import sys
import treading


def my_function(*args):
    # write you function here
    pass

  
if __name__ == "main":
    sys.setrecursionlimit(5000)
    threading.stack_size(2 ** 22)
    thread = threading.Thread(target=my_function,
                              args=("arg1", "arg2"))
    thread.start()
Asaga
  • 591
  • 4
  • 6